lua_getglobal

lua_getglobal[-0, +1, e] int lua_getglobal (lua_State *L, const char *name); Pushes onto the stack the value of the global name. Returns the type of that value.

lua_getfield

lua_getfield[-0, +1, e] int lua_getfield (lua_State *L, int index, const char *k); Pushes onto the stack the value t[k], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4). Returns the type of the pushed value.

lua_getextraspace

lua_getextraspace[-0, +0, –] void *lua_getextraspace (lua_State *L); Returns a pointer to a raw memory area associated with the given Lua state. The application can use this area for any purpose; Lua does not use it for anything. Each new thread has this area initialized with a copy of the area of the main thread. By default, this area has the size of a pointer to void, but you can recompile Lua with a different size for this area. (See LUA_EXTRASPACE in luaconf.h.)

lua_getallocf

lua_getallocf[-0, +0, –] lua_Alloc lua_getallocf (lua_State *L, void **ud); Returns the memory-allocation function of a given state. If ud is not NULL, Lua stores in *ud the opaque pointer given when the memory-allocator function was set.

lua_gc

lua_gc[-0, +0, m] int lua_gc (lua_State *L, int what, int data); Controls the garbage collector. This function performs several tasks, according to the value of the parameter what: LUA_GCSTOP: stops the garbage collector. LUA_GCRESTART: restarts the garbage collector. LUA_GCCOLLECT: performs a full garbage-collection cycle. LUA_GCCOUNT: returns the current amount of memory (in Kbytes) in use by Lua. LUA_GCCOUNTB: returns the remainder of dividing the current amount of bytes

lua_error

lua_error[-1, +0, v] int lua_error (lua_State *L); Generates a Lua error, using the value at the top of the stack as the error object. This function does a long jump, and therefore never returns (see luaL_error).

lua_dump

lua_dump[-0, +0, –] int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip); Dumps a function as a binary chunk. Receives a Lua function on the top of the stack and produces a binary chunk that, if loaded again, results in a function equivalent to the one dumped. As it produces parts of the chunk, lua_dump calls function writer (see lua_Writer) with the given data to write them. If strip is true, the bina

lua_Debug

lua_Debug typedef struct lua_Debug { int event; const char *name; /* (n) */ const char *namewhat; /* (n) */ const char *what; /* (S) */ const char *source; /* (S) */ int currentline; /* (l) */ int linedefined; /* (S) */ int lastlinedefined; /* (S) */ unsigned char nups; /* (u) number of upvalues */ unsigned char nparams; /* (u) number of parameters */ char isvararg; /* (u) */ char i

lua_createtable

lua_createtable[-0, +1, m] void lua_createtable (lua_State *L, int narr, int nrec); Creates a new empty table and pushes it onto the stack. Parameter narr is a hint for how many elements the table will have as a sequence; parameter nrec is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table. This preallocation is useful for performance when you know in advance how many elements the table will have. Otherwise you can use the

lua_copy

lua_copy[-0, +0, –] void lua_copy (lua_State *L, int fromidx, int toidx); Copies the element at index fromidx into the valid index toidx, replacing the value at that position. Values at other positions are not affected.