Lua comes with many built-in functions for working with values and controlling how a script runs. Other functions can be loaded from external modules, or are provided by the application that Lua is embedded in. LgScript has a library for using services from the game.
When a library is loaded, it usually creates a module table. The functions of the
string library, for example, are in a table named
string. So the
format function is accessed as string.format.
Some global variables are predefined by the standard library. Variables created by Lua will always begin with an underscore and have all capital letters.
| || The global environment. Global variables are stored as fields in this table. This includes the variable
| ||A string with the name and version number of this implementation. The most recent version is Lua 5.1. The version of LgScript is Lua 5.1+LgScript.|