lua_getmetatable

lua_getmetatable[-0, +(0|1), –] int lua_getmetatable (lua_State *L, int index); If the value at the given index has a metatable, the function pushes that metatable onto the stack and returns 1. Otherwise, the function returns 0 and pushes nothing on the stack.

string.gmatch()

string.gmatch (s, pattern)pattern§6.4.1spattern As an example, the following loop will iterate over all the words from string s, printing one per line: s = "hello world from Lua" for w in string.gmatch(s, "%a+") do print(w) end The next example collects all pairs key=value from the given string into a table: t = {} s = "from=world, to=Lua" for k, v in string.gmatch(s, "(%w+)=(%w+)") do t[k] = v end For this function, a caret '^' at the start of a pattern does not work as an anchor, as

luaL_pushresultsize

luaL_pushresultsize[-?, +1, m] void luaL_pushresultsize (luaL_Buffer *B, size_t sz); Equivalent to the sequence luaL_addsize, luaL_pushresult.

luaL_tolstring

luaL_tolstring[-0, +1, e] const char *luaL_tolstring (lua_State *L, int idx, size_t *len); Converts any Lua value at the given index to a C string in a reasonable format. The resulting string is pushed onto the stack and also returned by the function. If len is not NULL, the function also sets *len with the string length. If the value has a metatable with a __tostring field, then luaL_tolstring calls the corresponding metamethod with the value as argument, and uses the result of the call a

luaL_execresult

luaL_execresult[-0, +3, m] int luaL_execresult (lua_State *L, int stat); This function produces the return values for process-related functions in the standard library (os.execute and io.close).