The callerslocalvariablevalue( function allows a subroutine to access a local variable in the procedure that called it.
This function has one parameter:
variable – name of the variable to be accessed. This name must be quoted.
This function allows a subroutine to access a local variable in the procedure that called it. Normally a procedure can only access it’s own local variables, all others are out of bounds. For example, consider this code which sets up two local varaibles and then calls a subroutine.
let color = "Blue" let shape = "Star" call dispatch
Normally the dispatch procedure would have no access to the local variables set up in the procedure above, but with the callerslocalvariablevalue( function it can, like this:
message callerslocalvariablevalue("color")+" "+callerslocalvariablevalue("shape)
When the original code code is run, it will display the message Blue Star.
Warning: The callerslocalvariablevalue( function is a very unstructured way to handle data (as are its counterparts, setcallerslocal and info(“callerslocalvariables”)). Usually a much better way to pass a value to a subroutine is to use a parameter (see the parameter( function). However, if you write your own custom statements, this feature can be very useful to allow a custom statement to access a local variable in the procedure it is used in.
callerslocalvariablevalue( function can only be called from inside a subroutine – This function can only be used in a subroutine, if not in a subroutine, there are no caller’s local variables to access!
|10.2||New||New in this version.|