debug.upvalueid()

debug.upvalueid (f, n) Returns a unique identifier (as a light userdata) for the upvalue numbered n from the given function. These unique identifiers allow a program to check whether different closures share upvalues. Lua closures that share an upvalue (that is, that access a same external local variable) will return identical ids for those upvalue indices.

coroutine.create()

coroutine.create (f) Creates a new coroutine, with body f. f must be a function. Returns this new coroutine, an object with type "thread".

setmetatable()

setmetatable (table, metatable) Sets the metatable for the given table. (To change the metatable of other types from Lua code, you must use the debug library (§6.10).) If metatable is nil, removes the metatable of the given table. If the original metatable has a __metatable field, raises an error. This function returns table.

math.sin()

math.sin (x) Returns the sine of x (assumed to be in radians).

lua_isuserdata

lua_isuserdata[-0, +0, –] int lua_isuserdata (lua_State *L, int index); Returns 1 if the value at the given index is a userdata (either full or light), and 0 otherwise.

lua_typename

lua_typename[-0, +0, –] const char *lua_typename (lua_State *L, int tp); Returns the name of the type encoded by the value tp, which must be one the values returned by lua_type.

lua_numbertointeger

lua_numbertointeger int lua_numbertointeger (lua_Number n, lua_Integer *p); Converts a Lua float to a Lua integer. This macro assumes that n has an integral value. If that value is within the range of Lua integers, it is converted to an integer and assigned to *p. The macro results in a boolean indicating whether the conversion was successful. (Note that this range test can be tricky to do correctly without this macro, due to roundings.) This macro may evaluate its arguments more than once.

io.type()

io.type (obj) Checks whether obj is a valid file handle. Returns the string "file" if obj is an open file handle, "closed file" if obj is a closed file handle, or nil if obj is not a file handle.

lua_pushinteger

lua_pushinteger[-0, +1, –] void lua_pushinteger (lua_State *L, lua_Integer n); Pushes an integer with value n onto the stack.

lua_len

lua_len[-0, +1, e] void lua_len (lua_State *L, int index); Returns the length of the value at the given index. It is equivalent to the '#' operator in Lua (see §3.4.7) and may trigger a metamethod for the "length" event (see §2.4). The result is pushed on the stack.