Difference between revisions of "Call"
m (→Example) |
|||
Line 21: | Line 21: | ||
[ typical error handler | [ typical error handler | ||
[ assume logic ID for error handling logic is 'ErrHandler' | [ assume logic ID for error handling logic is 'ErrHandler' | ||
− | if(errorNumber > 0) { | + | if(errorNumber > 0) |
+ | { | ||
call(ErrHandler); | call(ErrHandler); | ||
− | } | + | } |
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 11:48, 14 April 2019
The call command executes a logic script.
Syntax
call(byt A);
Remarks
The logic with resource number A is executed one time. If it is not currently loaded when called, it is loaded, then executed, and then unloaded after returning. A script entry is not made for logics that are loaded/unloaded in support of the call command.
If a logic is likely to be called more than once or twice, it is better to load it using the load.logics command. This avoids having AGI continually load and unload the same logic over and over.
Possible Errors
If the logic does not exist, AGI will display a 'resource not found' message, and immediately quit.
Example
<syntaxhighlight lang="agi"> [ typical error handler [ assume logic ID for error handling logic is 'ErrHandler' if(errorNumber > 0)
{ call(ErrHandler); }
</syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in all AGI versions. |
Byte-Code Value: | 22 (0x16 hex) |