PUBLIC local variables
When you run a script using the EVENT action, you can define parameters to be sent to another script you want to be started. Sending the parameters is implemented as filling defined local variables of a started script with values from local variables of the script, which calls the EVENT action.
Example - Script that calls another script with the name E.SubScript
INT _i
_i := 1
EVENT E.SubScript(_par1 = _i)
END
Script E.SubScript
PUBLIC INT _par1
PUBLIC INT _par2
_par1 := 2
END
In the first script, the local variable _i is declared initialized to the value of 1 before calling the script E.SubScript
. Starting the embedded script E.SubScript
is performed by copying the value of the local variable _i of the first event into the local (PUBLIC) variable _par1
in the called script. During this operation, the existence of all the local variables of the called script is verified. These local variables must be declared as PUBLIC. In the case of a reference to a system object (ALIAS), the value is not, but the reference. The action EVENT is synchronous, so it waits for the termination of the embedded (called) script. After its termination, values (and references) are copied back into the local variables of the calling script. In the case of local variables of ALIAS type, references are copied. If some of the PUBLIC local variables are not initialized, when calling the script, their values, unlike others, are invalid.
Note
- When you edit a script in the D2000 CNF process, the existence of PUBLIC local variables in the called script is not checked.
Related pages:
0 komentárov