lua_status

lua_status[-0, +0, –] int lua_status (lua_State *L); Returns the status of the thread L. The status can be 0 (LUA_OK) for a normal thread, an error code if the thread finished the execution of a lua_resume with an error, or LUA_YIELD if the thread is suspended. You can only call functions in threads with status LUA_OK. You can resume threads with status LUA_OK (to start a new coroutine) or LUA_YIELD (to resume a coroutine).

Chunks

3.3.2 – Chunks The unit of compilation of Lua is called a chunk. Syntactically, a chunk is simply a block: chunk ::= block Lua handles a chunk as the body of an anonymous function with a variable number of arguments (see §3.4.11). As such, chunks can define local variables, receive arguments, and return values. Moreover, such anonymous function is compiled as in the scope of an external local variable called _ENV (see §2.2). The resulting function always has _ENV as its only upvalue, even if

luaL_checkversion

luaL_checkversion[-0, +0, v] void luaL_checkversion (lua_State *L); Checks whether the core running the call, the core that created the Lua state, and the code making the call are all using the same version of Lua. Also checks whether the core running the call and the core that created the Lua state are using the same address space.

lua_setuservalue

lua_setuservalue[-1, +0, –] void lua_setuservalue (lua_State *L, int index); Pops a value from the stack and sets it as the new value associated to the full userdata at the given index.

string.gsub()

string.gsub (s, pattern, repl [, n])snpattern§6.4.1replgsubgsubGlobal SUBstitution If repl is a string, then its value is used for replacement. The character % works as an escape character: any sequence in repl of the form %d, with d between 1 and 9, stands for the value of the d-th captured substring. The sequence %0 stands for the whole match. The sequence %% stands for a single %. If repl is a table, then the table is queried for every match, using the first capture as the key. If repl