lua_tothread

lua_tothread[-0, +0, –] lua_State *lua_tothread (lua_State *L, int index); Converts the value at the given index to a Lua thread (represented as lua_State*). This value must be a thread; otherwise, the function returns NULL.

xpcall()

xpcall (f, msgh [, arg1, ···]) This function is similar to pcall, except that it sets a new message handler msgh.

os.clock()

os.clock () Returns an approximation of the amount in seconds of CPU time used by the program.

lua_pushglobaltable

lua_pushglobaltable[-0, +1, –] void lua_pushglobaltable (lua_State *L); Pushes the global environment onto the stack.

lua_callk

lua_callk[-(nargs + 1), +nresults, e] void lua_callk (lua_State *L, int nargs, int nresults, lua_KContext ctx, lua_KFunction k); This function behaves exactly like lua_call, but allows the called function to yield (see §4.7).

lua_tolstring

lua_tolstring[-0, +0, m] const char *lua_tolstring (lua_State *L, int index, size_t *len); Converts the Lua value at the given index to a C string. If len is not NULL, it sets *len with the string length. The Lua value must be a string or a number; otherwise, the function returns NULL. If the value is a number, then lua_tolstring also changes the actual value in the stack to a string. (This change confuses lua_next when lua_tolstring is applied to keys during a table traversal.) lua_tolstr

lua_close

lua_close[-0, +0, –] void lua_close (lua_State *L); Destroys all objects in the given Lua state (calling the corresponding garbage-collection metamethods, if any) and frees all dynamic memory used by this state. On several platforms, you may not need to call this function, because all resources are naturally released when the host program ends. On the other hand, long-running programs that create multiple states, such as daemons or web servers, will probably need to close states as soon as t

Arithmetic Operators

3.4.1 – Arithmetic Operators Lua supports the following arithmetic operators: +: addition -: subtraction *: multiplication /: float division //: floor division %: modulo ^: exponentiation -: unary minus With the exception of exponentiation and float division, the arithmetic operators work as follows: If both operands are integers, the operation is performed over integers and the result is an integer. Otherwise, if both operands are numbers or strings that can be converted to number

package.path

package.path The path used by require to search for a Lua loader. At start-up, Lua initializes this variable with the value of the environment variable LUA_PATH_5_3 or the environment variable LUA_PATH or with a default path defined in luaconf.h, if those environment variables are not defined. Any ";;" in the value of the environment variable is replaced by the default path.

os.tmpname()

os.tmpname () Returns a string with a file name that can be used for a temporary file. The file must be explicitly opened before its use and explicitly removed when no longer needed. On POSIX systems, this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions in the time between getting the name and creating the file.) You still have to open the file to use it and to remove it (even if you do not use it). When poss