luaL_Buffer

luaL_Buffer typedef struct luaL_Buffer luaL_Buffer; Type for a string buffer. A string buffer allows C code to build Lua strings piecemeal. Its pattern of use is as follows: First declare a variable b of type luaL_Buffer. Then initialize it with a call luaL_buffinit(L, &b). Then add string pieces to the buffer calling any of the luaL_add* functions. Finish by calling luaL_pushresult(&b). This call leaves the final string on the top of the stack. If you know beforehand the to

luaL_buffinit

luaL_buffinit[-0, +0, –] void luaL_buffinit (lua_State *L, luaL_Buffer *B); Initializes a buffer B. This function does not allocate any space; the buffer must be declared as a variable (see luaL_Buffer).

luaL_buffinitsize

luaL_buffinitsize[-?, +?, m] char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz); Equivalent to the sequence luaL_buffinit, luaL_prepbuffsize.

luaL_callmeta

luaL_callmeta[-0, +(0|1), e] int luaL_callmeta (lua_State *L, int obj, const char *e); Calls a metamethod. If the object at index obj has a metatable and this metatable has a field e, this function calls this field passing the object as its only argument. In this case this function returns true and pushes onto the stack the value returned by the call. If there is no metatable or no metamethod, this function returns false (without pushing any value on the stack).

luaL_checkany

luaL_checkany[-0, +0, v] void luaL_checkany (lua_State *L, int arg); Checks whether the function has an argument of any type (including nil) at position arg.

luaL_checkinteger

luaL_checkinteger[-0, +0, v] lua_Integer luaL_checkinteger (lua_State *L, int arg); Checks whether the function argument arg is an integer (or can be converted to an integer) and returns this integer cast to a lua_Integer.

luaL_checklstring

luaL_checklstring[-0, +0, v] const char *luaL_checklstring (lua_State *L, int arg, size_t *l); Checks whether the function argument arg is a string and returns this string; if l is not NULL fills *l with the string's length. This function uses lua_tolstring to get its result, so all conversions and caveats of that function apply here.

luaL_checknumber

luaL_checknumber[-0, +0, v] lua_Number luaL_checknumber (lua_State *L, int arg); Checks whether the function argument arg is a number and returns this number.

luaL_checkoption

luaL_checkoption[-0, +0, v] int luaL_checkoption (lua_State *L, int arg, const char *def, const char *const lst[]); Checks whether the function argument arg is a string and searches for this string in the array lst (which must be NULL-terminated). Returns the index in the array where the string was found. Raises an error if the argument is not a string or if the string cannot be found. If def is not NULL, the function uses d

luaL_checkstack

luaL_checkstack[-0, +0, v] void luaL_checkstack (lua_State *L, int sz, const char *msg); Grows the stack size to top + sz elements, raising an error if the stack cannot grow to that size. msg is an additional text to go into the error message (or NULL for no additional text).