
Similar to load, but gets the chunk from the given string.Īllows a program to traverse all fields of a table. Similar to load, but gets the chunk from file filename or from the standard input, if no file name is given. Each call to func must return a string that concatenates with previous results. Loads a chunk using function func to get its pieces. This functions fetches the indices and values of tables. Otherwise, returns the metatable of the given object. Otherwise, if the object's metatable has a "_metatable" field, returns the associated value.

If object does not have a metatable, returns nil. If the given function is not a Lua function, or if f is 0, getfenv returns the global environment. f can be a Lua function or a number that specifies the function at that stack level − Level 1 is the function calling getfenv. Returns the current environment in use by the function. Thus is the global variable that holds the global environment (that is, _G._G = _G). The errors will be propagated to the caller. If no parameter is passed, then this function executes the contents of standard input. It opens the file and executes the contents of the file as a chunk. Includes the automatic memory management functions related to garbage collection as explained in Lua - Garbage Collection. Includes error handling functions like assert, error as explained in Lua - Error Handling. The following table provides links of related pages and lists the functions that are covered in various part of this Lua tutorial. We have used the basic library throughout the tutorial under various topics. Basic library, which includes the coroutine sub-library.

These standard libraries built in official C API are provided as separate C modules. These libraries provide services within the Lua programming language and also outside services like file and db operations. Lua standard libraries provide a rich set of functions that is implemented directly with the C API and is in-built with Lua programming language.
