do() operator for macros

Tinderbox Icon

The v4.0.0 do() operator do lets rules and actions use macros.

do(macro[,arg1,arg2,arg3] )

The first argument is the name of the macro. Subsequent arguments are optional and are passed to the macro, which can refer to them as $1, $2, $3, and so forth.

After the macro is evaluated, its result is returned and is parsed again as a rule, action, or expression. For example:

Name=do(computeName,$Name,$Name(parent))

sets name to the result of a macro.

do(Instructions);

simply executes whatever actions are returned by Instructions.

Note that macros can also be used in (agent) queries. Note however that the caret syntax ^do() is required in agent queries; conversely in actions it is not used, i.e. just do(). A little confusing is the fact that if statements in action do require the carets, until you realise that the method is evaluating a query (q.v.). Thus:


Up: Actions & Rules
Previous: sum_if() operator  Next: runCommand() operator 

[Last updated: 3 Dec 2008]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox