SCRIPT_PLAY_LOCAL Function
Syntax
Arguments
- script_nameCharacter
The name of a script or function. The Script_Name parameter can include an optional library name if you which to specify a script that is in a different database (.alb file), or is in a dictionary of a table or set that is not attached to the current database.
Description
Returns TRUE if script was played.
Discussion
SCRIPT_PLAY_LOCAL() is the same as SCRIPT_PLAY(), but it inherits the variable name space of the calling script. This means that Script_Name can reference any variables defined in the calling script, and that any variables set or created by Script_Name are available to the calling script.
Example
This script is called "play_message".
ui_msg_box("Title",message)
This script calls "PLAY_message".
message = "Hello world" script_play_local("play_message")
This script will generate an error because when "PLAY_message" is called, the variable "message" is not defined in the context of the "play_message" script.
message = "Hello world" script_play("play_message")
The following example, shows how functions can be called "locally", which is analogous to "script_play_local() ". This is the script.
title = "Message box title" message = "Hello world" 'get a pointer to the local variable frame p = local_variables() 'call the show_message() function and pass the pointer to the local 'variable frame. Show_message(p)
Here is the function definition.
function show_message as C(var_frame as P) with var_frame ui_msg_box(title,message) end with end function
Limitations
Desktop applications only.
See Also