lua_setmetatable

lua_setmetatable[-1, +0, โ€“] void lua_setmetatable (lua_State *L, int index); Pops a table from the stack and sets it as the new metatable for the value at the given index.

luaL_argcheck

luaL_argcheck[-0, +0, v] void luaL_argcheck (lua_State *L, int cond, int arg, const char *extramsg); Checks whether cond is true. If it is not, raises an error with a standard message (see luaL_argerror).

debug.setupvalue()

debug.setupvalue (f, up, value) This function assigns the value value to the upvalue with index up of the function f. The function returns nil if there is no upvalue with the given index. Otherwise, it returns the name of the upvalue.

os.rename()

os.rename (oldname, newname) Renames the file or directory named oldname to newname. If this function fails, it returns nil, plus a string describing the error and the error code. Otherwise, it returns true.

lua_pushvfstring

lua_pushvfstring[-0, +1, m] const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp); Equivalent to lua_pushfstring, except that it receives a va_list instead of a variable number of arguments.

luaL_gsub

luaL_gsub[-0, +1, m] const char *luaL_gsub (lua_State *L, const char *s, const char *p, const char *r); Creates a copy of string s by replacing any occurrence of the string p with the string r. Pushes the resulting string on the stack and returns it.

file:close()

file:close () Closes file. Note that files are automatically closed when their handles are garbage collected, but that takes an unpredictable amount of time to happen. When closing a file handle created with io.popen, file:close returns the same values returned by os.execute.

lua_stringtonumber

lua_stringtonumber[-0, +1, โ€“] size_t lua_stringtonumber (lua_State *L, const char *s); Converts the zero-terminated string s to a number, pushes that number into the stack, and returns the total size of the string, that is, its length plus one. The conversion can result in an integer or a float, according to the lexical conventions of Lua (see ยง3.1). The string may have leading and trailing spaces and a sign. If the string is not a valid numeral, returns 0 and pushes nothing. (Note that the

luaL_newmetatable

luaL_newmetatable[-0, +1, m] int luaL_newmetatable (lua_State *L, const char *tname); If the registry already has the key tname, returns 0. Otherwise, creates a new table to be used as a metatable for userdata, adds to this new table the pair __name = tname, adds to the registry the pair [tname] = new table, and returns 1. (The entry __name is used by some error-reporting functions.) In both cases pushes onto the stack the final value associated with tname in the registry.

math.tan()

math.tan (x) Returns the tangent of x (assumed to be in radians).