lua_getinfo

lua_getinfo[-(0|1), +(0|1|2), e] int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); Gets information about a specific function or function invocation. To get information about a function invocation, the parameter ar must be a valid activation record that was filled by a previous call to lua_getstack or given as argument to a hook (see lua_Hook). To get information about a function you push it onto the stack and start the what string with the character '>'. (In that case,

lua_getlocal

lua_getlocal[-0, +(0|1), –] const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); Gets information about a local variable of a given activation record or a given function. In the first case, the parameter ar must be a valid activation record that was filled by a previous call to lua_getstack or given as argument to a hook (see lua_Hook). The index n selects which local variable to inspect; see debug.getlocal for details about variable indices and names. lua_getlocal pushes

lua_getmetatable

lua_getmetatable[-0, +(0|1), –] int lua_getmetatable (lua_State *L, int index); If the value at the given index has a metatable, the function pushes that metatable onto the stack and returns 1. Otherwise, the function returns 0 and pushes nothing on the stack.

lua_getstack

lua_getstack[-0, +0, –] int lua_getstack (lua_State *L, int level, lua_Debug *ar); Gets information about the interpreter runtime stack. This function fills parts of a lua_Debug structure with an identification of the activation record of the function executing at a given level. Level 0 is the current running function, whereas level n+1 is the function that has called level n (except for tail calls, which do not count on the stack). When there are no errors, lua_getstack returns 1; when ca

lua_gettable

lua_gettable[-1, +1, e] int lua_gettable (lua_State *L, int index); Pushes onto the stack the value t[k], where t is the value at the given index and k is the value at the top of the stack. This function pops the key from the stack, pushing the resulting value in its place. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4). Returns the type of the pushed value.

lua_gettop

lua_gettop[-0, +0, –] int lua_gettop (lua_State *L); Returns the index of the top element in the stack. Because indices start at 1, this result is equal to the number of elements in the stack; in particular, 0 means an empty stack.

lua_getupvalue

lua_getupvalue[-0, +(0|1), –] const char *lua_getupvalue (lua_State *L, int funcindex, int n); Gets information about the n-th upvalue of the closure at index funcindex. It pushes the upvalue's value onto the stack and returns its name. Returns NULL (and pushes nothing) when the index n is greater than the number of upvalues. For C functions, this function uses the empty string "" as a name for all upvalues. (For Lua functions, upvalues are the external local variables that the function us

lua_getuservalue

lua_getuservalue[-0, +1, –] int lua_getuservalue (lua_State *L, int index); Pushes onto the stack the Lua value associated with the full userdata at the given index. Returns the type of the pushed value.

lua_Hook

lua_Hook typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); Type for debugging hook functions. Whenever a hook is called, its ar argument has its field event set to the specific event that triggered the hook. Lua identifies these events with the following constants: LUA_HOOKCALL, LUA_HOOKRET, LUA_HOOKTAILCALL, LUA_HOOKLINE, and LUA_HOOKCOUNT. Moreover, for line events, the field currentline is also set. To get the value of any other field in ar, the hook must call lua_getinfo. For ca

lua_insert

lua_insert[-1, +1, –] void lua_insert (lua_State *L, int index); Moves the top element into the given valid index, shifting up the elements above this index to open space. This function cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.