lua_tointegerx

lua_tointegerx[-0, +0, –] lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum); Converts the Lua value at the given index to the signed integral type lua_Integer. The Lua value must be an integer, or a number or string convertible to an integer (see §3.4.3); otherwise, lua_tointegerx returns 0. If isnum is not NULL, its referent is assigned a boolean value that indicates whether the operation succeeded.

lua_tointeger

lua_tointeger[-0, +0, –] lua_Integer lua_tointeger (lua_State *L, int index); Equivalent to lua_tointegerx with isnum equal to NULL.

lua_tocfunction

lua_tocfunction[-0, +0, –] lua_CFunction lua_tocfunction (lua_State *L, int index); Converts a value at the given index to a C function. That value must be a C function; otherwise, returns NULL.

lua_toboolean

lua_toboolean[-0, +0, –] int lua_toboolean (lua_State *L, int index); Converts the Lua value at the given index to a C boolean value (0 or 1). Like all tests in Lua, lua_toboolean returns true for any Lua value different from false and nil; otherwise it returns false. (If you want to accept only actual boolean values, use lua_isboolean to test the value's type.)

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

lua_status

lua_status[-0, +0, –] int lua_status (lua_State *L); Returns the status of the thread L. The status can be 0 (LUA_OK) for a normal thread, an error code if the thread finished the execution of a lua_resume with an error, or LUA_YIELD if the thread is suspended. You can only call functions in threads with status LUA_OK. You can resume threads with status LUA_OK (to start a new coroutine) or LUA_YIELD (to resume a coroutine).

lua_State

lua_State typedef struct lua_State lua_State; An opaque structure that points to a thread and indirectly (through the thread) to the whole state of a Lua interpreter. The Lua library is fully reentrant: it has no global variables. All information about a state is accessible through this structure. A pointer to this structure must be passed as the first argument to every function in the library, except to lua_newstate, which creates a Lua state from scratch.

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.

lua_setupvalue

lua_setupvalue[-(0|1), +0, –] const char *lua_setupvalue (lua_State *L, int funcindex, int n); Sets the value of a closure's upvalue. It assigns the value at the top of the stack to the upvalue and returns its name. It also pops the value from the stack. Returns NULL (and pops nothing) when the index n is greater than the number of upvalues. Parameters funcindex and n are as in function lua_getupvalue.

lua_settop

lua_settop[-?, +?, –] void lua_settop (lua_State *L, int index); Accepts any index, or 0, and sets the stack top to this index. If the new top is larger than the old one, then the new elements are filled with nil. If index is 0, then all stack elements are removed.