lua_newuserdata

lua_newuserdata[-0, +1, m] void *lua_newuserdata (lua_State *L, size_t size); This function allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address. The host program can freely use this memory.

lua_newthread

lua_newthread[-0, +1, m] lua_State *lua_newthread (lua_State *L); Creates a new thread, pushes it on the stack, and returns a pointer to a lua_State that represents this new thread. The new thread returned by this function shares with the original thread its global environment, but has an independent execution stack. There is no explicit function to close or to destroy a thread. Threads are subject to garbage collection, like any Lua object.

lua_newtable

lua_newtable[-0, +1, m] void lua_newtable (lua_State *L); Creates a new empty table and pushes it onto the stack. It is equivalent to lua_createtable(L, 0, 0).

lua_newstate

lua_newstate[-0, +0, –] lua_State *lua_newstate (lua_Alloc f, void *ud); Creates a new thread running in a new, independent state. Returns NULL if it cannot create the thread or the state (due to lack of memory). The argument f is the allocator function; Lua does all memory allocation for this state through this function (see lua_Alloc). The second argument, ud, is an opaque pointer that Lua passes to the allocator in every call.

lua_load

lua_load[-0, +1, –] int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode); Loads a Lua chunk without running it. If there are no errors, lua_load pushes the compiled chunk as a Lua function on top of the stack. Otherwise, it pushes an error message. The return values of lua_load are: LUA_OK: no errors; LUA_ERRSYNTAX: syntax error during precompilation; LUA_ERRMEM: memory allocation

lua_len

lua_len[-0, +1, e] void lua_len (lua_State *L, int index); Returns the length of the value at the given index. It is equivalent to the '#' operator in Lua (see §3.4.7) and may trigger a metamethod for the "length" event (see §2.4). The result is pushed on the stack.

lua_KFunction

lua_KFunction typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); Type for continuation functions (see §4.7).

lua_KContext

lua_KContext typedef ... lua_KContext; The type for continuation-function contexts. It must be a numeric type. This type is defined as intptr_t when intptr_t is available, so that it can store pointers too. Otherwise, it is defined as ptrdiff_t.

lua_isyieldable

lua_isyieldable[-0, +0, –] int lua_isyieldable (lua_State *L); Returns 1 if the given coroutine can yield, and 0 otherwise.

lua_isuserdata

lua_isuserdata[-0, +0, –] int lua_isuserdata (lua_State *L, int index); Returns 1 if the value at the given index is a userdata (either full or light), and 0 otherwise.