Parameter
(Engine-Level Function)
Description: | Returns the value of (or may assign a value to) a parameter of a module, specified by the index. |
Returns: | varies |
Usage: | Script or steady state. |
Function Groups: | Basic Module, Variable |
Related to: | BuffToParm | NParm | ParmToBuff | PType | ResetParm |
Format: | Parameter(Object, Index) |
Parameters: |
Object |
Required. Any object (the object value of any module instance). |
Index |
Required. Any numeric expression giving the number of the parameter of interest, starting from 1. |
Comments: | This function returns the value passed in the module call in the position Index. It may also appear on the left side of an assignment operator (=), in which case it will try to assign the value to the parameter in Index. The parameter must be a reference type parameter to receive an assignment (all undeclared parameters default to reference type). Assignment to a non-reference parameter or function has no effect. The return value of Parameter is invalid if there is no parameter at Index. For launched modules, this function will not look at parameters beyond the number of formal parameters. |
Example:
If 1 Main; [ Parameter(Self(), 5) = 4; ]
This attempts to set parameter #5 to 4. Either the module must have parameter 5 declared as a reference parameter, or have no declaration for parameter 5 at all. The module call must have at least 5 parameters listed, and the fifth parameter must be a variable or array element. If any of these conditions are not met, nothing happens. If the module call is:
Show Normalize(1, 2, 3, 4, X);
Then X is set to 4.