Description: This function returns the number of module instances currently running.
Returns: Numeric
Usage: Script or Steady State
Format: NumInstances(Module)
Parameters: Module { Object value or Module } { required } { no default }
Any module or object value of the module to count.
Comments: This function is useful for counting both the number of active instances of the current module as well as the number of active instances of another module.
Example:
numThis = NumInstances(Self());
If ! Valid(numAnother);
[
numAnother = NumInstances(FindVariable("Calculations", Self(),
0, 1));
]
These statements count the number of active instances of the current module and the Calculations module. Notice that the script is necessary in the second case, not because of the NumInstances function, but because of the FindVariable function.
See Also: