User Tools

Site Tools



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.

Built-in Libraries

Predefined Variables

Some global variables are predefined by the standard library. Variables created by Lua will always begin with an underscore and have all capital letters.

_G The global environment. Global variables are stored as fields in this table. This includes the variable _G, so _G["_G"]==_G.
_VERSION 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.
lgscript/lua_library.txt · Last modified: 2009/09/01 00:46 by telliamed