callerslocalvariablevalue(
VARIABLE
)

The callerslocalvariablevalue( function allows a subroutine to access a local variable in the procedure that called it.


Parameters

This function has one parameter:

variable – name of the variable to be accessed. This name must be quoted.


Description

This function allows a subroutine to access a local variable in the procedure that called it. Normally a procedure can only access its 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.


Error Messages

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!


See Also


History

VersionStatusNotes
10.2NewNew in this version.