Skip to content

GlobalVars()

The GlobalVars function returns a handle to the set of global variables. Read more about these in the Variables topic in the Macro section.

This function does not accept any arguments.

  • Handle:
    The function returns a handle of the set of global variables.

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