Argument name preceded by an exclamation mark ('!') either from the declaration line or the calling line will NOT be evaluated before passing. In the following example, the last line shows the string "{something}" being passed into the function "showme" as is. The argument is evaluated only inside the function and therefore pick up the local variable, instead of the global as in the first "showme" call.
function showme { var something = "in here"; display "Show me {arg%what}<br>\n"; }
var something = "out there"; showme what="{something}"; // Show me out there showme !what="{something}"; // Show me in here
You can force an argument to be absolute from the declaration line:
function showme !what="{something}" { var something = "in here"; display "Show me {arg%what}<br>\n"; }
var something = "out there"; showme; // Show me in here
|