Code-factoids are a special type of factoid whose text is executed as Perl instructions. The return value from these instructions is the final text of the factoid. This final text is then parsed and treated like any other factoid text.
By default, the variables created within code-factoids do not persist between factoid invocations. This behavior can be overridden by factsetting a persist-key with a unique value.
To create a code-factoid, simply wrap the factoid text with curly braces.
factadd keyword { code here }
#### Special variables
There are some special variables available to code-factoids.
*`@args` - any arguments passed to the factoid (note that invoker's nick is passed if no arguments are specified)
*`$nick` - nick of the person invoking the factoid
*`$channel` - channel in which the factoid is being invoked
#### testargs example
<pragma-> factadd global testargs { return "/say No arguments!" if not @args;
if (@args == 1) { return "/say One argument: $args[0]!" } elsif
(@args == 2) { return "/say Two arguments: $args[0] and $args[1]!"; }