lua_type

lua_type[-0, +0, –] int lua_type (lua_State *L, int index); Returns the type of the value in the given valid index, or LUA_TNONE for a non-valid (but acceptable) index. The types returned by lua_type are coded by the following constants defined in lua.h: LUA_TNIL (0), LUA_TNUMBER, LUA_TBOOLEAN, LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, LUA_TUSERDATA, LUA_TTHREAD, and LUA_TLIGHTUSERDATA.

luaL_addvalue

luaL_addvalue[-1, +?, m] void luaL_addvalue (luaL_Buffer *B); Adds the value at the top of the stack to the buffer B (see luaL_Buffer). Pops the value. This is the only function on string buffers that can (and must) be called with an extra element on the stack, which is the value to be added to the buffer.

lua_xmove

lua_xmove[-?, +?, –] void lua_xmove (lua_State *from, lua_State *to, int n); Exchange values between different threads of the same state. This function pops n values from the stack from, and pushes them onto the stack to.

math.pi

math.pi The value of π.

debug.getlocal()

debug.getlocal ([thread,] f, local) This function returns the name and the value of the local variable with index local of the function at level f of the stack. This function accesses not only explicit local variables, but also parameters, temporaries, etc. The first parameter or local variable has index 1, and so on, following the order that they are declared in the code, counting only the variables that are active in the current scope of the function. Negative indices refer to vararg para

lua_upvaluejoin

lua_upvaluejoin[-0, +0, –] void lua_upvaluejoin (lua_State *L, int funcindex1, int n1, int funcindex2, int n2); Make the n1-th upvalue of the Lua closure at index funcindex1 refer to the n2-th upvalue of the Lua closure at index funcindex2.

io.open()

io.open (filename [, mode]) This function opens a file, in the mode specified in the string mode. In case of success, it returns a new file handle. The mode string can be any of the following: "r": read mode (the default); "w": write mode; "a": append mode; "r+": update mode, all previous data is preserved; "w+": update mode, all previous data is erased; "a+": append update mode, previous data is preserved, writing is only allowed at the end of file. The mode string can also

tonumber()

tonumber (e [, base]) When called with no base, tonumber tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then tonumber returns this number; otherwise, it returns nil. The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see §3.1). (The string may have leading and trailing spaces and a sign.) When called with base, then e must be a string to be interpreted as an integer n

Assignment

3.3.3 – Assignment Lua allows multiple assignments. Therefore, the syntax for assignment defines a list of variables on the left side and a list of expressions on the right side. The elements in both lists are separated by commas: stat ::= varlist ‘=’ explist varlist ::= var {‘,’ var} explist ::= exp {‘,’ exp} Expressions are discussed in §3.4. Before the assignment, the list of values is adjusted to the length of the list of variables. If there are more values than needed, the excess valu

lua_setfield

lua_setfield[-1, +0, e] void lua_setfield (lua_State *L, int index, const char *k); Does the equivalent to t[k] = v, where t is the value at the given index and v is the value at the top of the stack. This function pops the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event (see §2.4).