lua_setglobal

lua_setglobal[-1, +0, e] void lua_setglobal (lua_State *L, const char *name); Pops a value from the stack and sets it as the new value of global name.

lua_sethook

lua_sethook[-0, +0, –] void lua_sethook (lua_State *L, lua_Hook f, int mask, int count); Sets the debugging hook function. Argument f is the hook function. mask specifies on which events the hook will be called: it is formed by a bitwise OR of the constants LUA_MASKCALL, LUA_MASKRET, LUA_MASKLINE, and LUA_MASKCOUNT. The count argument is only meaningful when the mask includes LUA_MASKCOUNT. For each event, the hook is called as explained below: The call hook: is called when the interpre

lua_seti

lua_seti[-1, +0, e] void lua_seti (lua_State *L, int index, lua_Integer n); Does the equivalent to t[n] = 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).

lua_setlocal

lua_setlocal[-(0|1), +0, –] const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); Sets the value of a local variable of a given activation record. It assigns the value at the top of the stack to the variable and returns its name. It also pops the value from the stack. Returns NULL (and pops nothing) when the index is greater than the number of active local variables. Parameters ar and n are as in function lua_getlocal.

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.

lua_settable

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

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.

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_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_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.