Environments

  • Global variables are kept in the Global Environment table
    • The Global Environment is stored in variable _G

Examples of using _G

value = _G[varname] -- get the value of a global variable _G[varname] = value -- set the value of a global variable varname = value -- much easier way to set the value