To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationFunction overwriting

Functionalities provided by the language can be overwritten by simply defining a new one.

None of the "core functions", "reference functions" or "object functions" can be overwritten (although many of them have alternatives which can indeed be overwritten). No basic language constructs can be overwritten either.

Where it can be achieved, it is done by simply declaring the function within the code.

In this example, we are overwriting the multiply (removed as of version 1.3.7) function:

function multiply($n, $times)
  $out = 0
  for($i = 0, $i < $times, 1)
    $out = $out + $n
  end for

  return $out
end function

Here is another example:

function input_validate($x, $pattern)
  return string_matches($x, $pattern)
end function

There are no comments on this page.

New comment
Code previewClose
Feedback 👍
Comments are sent via email to me.