Loading

DEF


stack
Since v1.0.0
Available on all platforms
See also

Configuration parameters


The DEF function allows you to define new WarpScript functions or redefine existing ones for the duration of your script execution.

The function expects on the stack a macro which will be used as the content of the newly defined function, and a name under which to define the new function.

When redefining a function, if the function being redefined is used within the macro, the code which will be executed is the current one, as the binding of function to code is done at the time when the macro is defined and not when it is executed.

You may therefore add limits to the use of an existing function by rewrapping it in a macro which will be associated with the original function name.

To remove redefined functions see CLEARDEFS.

Signature

Examples

<% 'Hello' %> 'NOW' DEF NOW