The info(“callerslocalvariables”) function returns a list of local variables defined in the procedure that called the current procedure.
This function returns a list of local variables defined in the procedure that called the current procedure. Each variable name is on a separate line (separated by carriage returns). For example, consider this code which sets up two local varaibles and then calls a subroutine.
let color = "Blue" let shape = "Star" call dispatch message color
The code in the dispatch procedure can find out what local variables exist in the original procedure by using the info(“callerslocalvariables”) function. For example, here’s a version of dispatch that checks to see if there is a local variable named color, and if so, sets it to Red. If not, it returns an error (see Error Handling).
if arraycontains(info("callerslocalvariables"),"color",cr()) setcallerslocal "color","Red" else returnerror "No color variable!!" endif
Warning: The info(“callerslocalvaraibles”) function is a very unstructured way to handle data (as are its counterparts, callerslocalvariablevalue( and setcallerslocal). Usually a much better way to pass a value from a subroutine is to use a parameters (see the parameter( function and setparameter statement). 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.
|10.2||New||New in this version.|