GlobalVars()
Description
Section titled “Description”The GlobalVars function returns a handle to the set of global variables. Read more about these in the Variables topic in the Macro section.
Arguments
Section titled “Arguments”This function does not accept any arguments.
Return
Section titled “Return”- Handle:
The function returns a handle of the set of global variables.
Example
Section titled “Example”This example sets, gets, and deletes a global variable:
| Copy CodeLua |
| ``` |
| return function() |
-- Stores a local Lua variable with the handle for the global variable set.local variableSet = GlobalVars()-- Sets a global variable with an integer value using the SetVar() function.SetVar(variableSet, "myGlobalVar", 42)-- Prints the global variable using the GetVar() function.Printf("The value of myGlobalVar is: " .. GetVar(variableSet, "myGlobalVar"))-- Deletes the global variable using the DelVar() function.DelVar(variableSet, "myGlobalVar")end