pcall()

pcall (f [, arg1, ···]) Calls function f with the given arguments in protected mode. This means that any error inside f is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message.

print()

print (···)stdouttostringprintstring.formatio.write

string.byte()

string.byte (s [, i [, j]])s[i]s[i+1]s[j]ijistring.sub Numeric codes are not necessarily portable across platforms.

luaL_unref

luaL_unref[-0, +0, –] void luaL_unref (lua_State *L, int t, int ref); Releases reference ref from the table at index t (see luaL_ref). The entry is removed from the table, so that the referred object can be collected. The reference ref is also freed to be used again. If ref is LUA_NOREF or LUA_REFNIL, luaL_unref does nothing.

lua_getfield

lua_getfield[-0, +1, e] int lua_getfield (lua_State *L, int index, const char *k); Pushes onto the stack the value t[k], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4). Returns the type of the pushed value.

lua_getglobal

lua_getglobal[-0, +1, e] int lua_getglobal (lua_State *L, const char *name); Pushes onto the stack the value of the global name. Returns the type of that value.

lua_setuservalue

lua_setuservalue[-1, +0, –] void lua_setuservalue (lua_State *L, int index); Pops a value from the stack and sets it as the new value associated to the full userdata at the given index.

package.cpath

package.cpath The path used by require to search for a C loader. Lua initializes the C path package.cpath in the same way it initializes the Lua path package.path, using the environment variable LUA_CPATH_5_3, or the environment variable LUA_CPATH, or a default path defined in luaconf.h.

lua_createtable

lua_createtable[-0, +1, m] void lua_createtable (lua_State *L, int narr, int nrec); Creates a new empty table and pushes it onto the stack. Parameter narr is a hint for how many elements the table will have as a sequence; parameter nrec is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table. This preallocation is useful for performance when you know in advance how many elements the table will have. Otherwise you can use the

lua_next

lua_next[-1, +(2|0), e] int lua_next (lua_State *L, int index); Pops a key from the stack, and pushes a key–value pair from the table at the given index (the "next" pair after the given key). If there are no more elements in the table, then lua_next returns 0 (and pushes nothing). A typical traversal looks like this: /* table is in the stack at index 't' */ lua_pushnil(L); /* first key */ while (lua_next(L, t) != 0) { /* uses 'key' (at index -2) and 'value' (at index -1) */ printf("%