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.

lua_concat

lua_concat[-n, +1, e] void lua_concat (lua_State *L, int n); Concatenates the n values at the top of the stack, pops them, and leaves the result at the top. If n is 1, the result is the single value on the stack (that is, the function does nothing); if n is 0, the result is the empty string. Concatenation is performed following the usual semantics of Lua (see §3.4.6).

lua_compare

lua_compare[-0, +0, e] int lua_compare (lua_State *L, int index1, int index2, int op); Compares two Lua values. Returns 1 if the value at index index1 satisfies op when compared with the value at index index2, following the semantics of the corresponding Lua operator (that is, it may call metamethods). Otherwise returns 0. Also returns 0 if any of the indices is not valid. The value of op must be one of the following constants: LUA_OPEQ: compares for equality (==) LUA_OPLT: compares f

lua_close

lua_close[-0, +0, –] void lua_close (lua_State *L); Destroys all objects in the given Lua state (calling the corresponding garbage-collection metamethods, if any) and frees all dynamic memory used by this state. On several platforms, you may not need to call this function, because all resources are naturally released when the host program ends. On the other hand, long-running programs that create multiple states, such as daemons or web servers, will probably need to close states as soon as t