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

lua_checkstack

lua_checkstack[-0, +0, –] int lua_checkstack (lua_State *L, int n); Ensures that the stack has space for at least n extra slots (that is, that you can safely push up to n values into it). It returns false if it cannot fulfill the request, either because it would cause the stack to be larger than a fixed maximum size (typically at least several thousand elements) or because it cannot allocate memory for the extra space. This function never shrinks the stack; if the stack already has space for

lua_CFunction

lua_CFunction typedef int (*lua_CFunction) (lua_State *L); Type for C functions. In order to communicate properly with Lua, a C function must use the following protocol, which defines the way parameters and results are passed: a C function receives its arguments from Lua in its stack in direct order (the first argument is pushed first). So, when the function starts, lua_gettop(L) returns the number of arguments received by the function. The first argument (if any) is at index 1 and its last

lua_callk

lua_callk[-(nargs + 1), +nresults, e] void lua_callk (lua_State *L, int nargs, int nresults, lua_KContext ctx, lua_KFunction k); This function behaves exactly like lua_call, but allows the called function to yield (see §4.7).

lua_call

lua_call[-(nargs+1), +nresults, e] void lua_call (lua_State *L, int nargs, int nresults); Calls a function. To call a function you must use the following protocol: first, the function to be called is pushed onto the stack; then, the arguments to the function are pushed in direct order; that is, the first argument is pushed first. Finally you call lua_call; nargs is the number of arguments that you pushed onto the stack. All arguments and the function value are popped from the stack when th

lua_atpanic

lua_atpanic[-0, +0, –] lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf); Sets a new panic function and returns the old one (see §4.6).

lua_arith

lua_arith[-(2|1), +1, e] void lua_arith (lua_State *L, int op); Performs an arithmetic or bitwise operation over the two values (or one, in the case of negations) at the top of the stack, with the value at the top being the second operand, pops these values, and pushes the result of the operation. The function follows the semantics of the corresponding Lua operator (that is, it may call metamethods). The value of op must be one of the following constants: LUA_OPADD: performs addition (+

lua_Alloc

lua_Alloc typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); The type of the memory-allocation function used by Lua states. The allocator function must provide a functionality similar to realloc, but not exactly the same. Its arguments are ud, an opaque pointer passed to lua_newstate; ptr, a pointer to the block being allocated/reallocated/freed; osize, the original size of the b