CalledInstances
(Engine-Level Function)
Description: | Returns the object values of module instances that are called by a particular module. |
Returns: | Object(s) |
Usage: | Script Only. |
Function Groups: | Advanced Module, Compilation and On-Line Modifications |
Related to: | ChildInstances | Self | GetInstance | Instance | NumInstances | Valid |
Format: | CalledInstances(Object[, Options]) |
Parameters: |
Object | ||||||||||||
Required. An object value of the module instance for which to get the number of called instances. | ||||||||||||
Options | ||||||||||||
Optional. Any numeric expression that defines which modules are to be included in the returned set. (See: Bitwise Parameters & Operations)
|
Comments: | The return value is an array of objects which are called from Object. If no instances are called from Object, Invalid is returned. |
Example:
i = -1; ... If i == -1; [ NumCalled = CalledInstances(Self()); i++; ] If Valid(NumCalled[i]); [ Slay(NumCalled[i], 0); i++; ]
The first If statement and script creates an array of object values to all instances called by the current module. The second If and script slays all of these instances. Notice that in the case of the first script, the action trigger must be based on i rather than on a Valid test of NumCalled. If this were not the case and ! Valid(NumCalled) was used instead, then if there were no instances called from this module, CalledInstances would return Invalid, and an "if one" (infinite loop) condition would occur.