--------------------------------------------------------------------------------
luaL_newmetatable
[-0, +1, m]
int luaL_newmetatable (lua_State *L, const char *tname);
If the registry already has the key tname, returns 0. Otherwise, creates a new table to be used as a metatable for userdata, adds it to the registry with key tname, and returns 1.
In both cases pushes onto the stack the final value associated with tname in the registry.
--------------------------------------------------------------------------------
luaL_newstate
[-0, +0, -]
lua_State *luaL_newstate (void);
Creates a new Lua state. It calls lua_newstate with an allocator based on the standard C realloc function and then sets a panic function (see lua_atpanic) that prints an error message to the standard error output in case of fatal errors.
Returns the new state, or NULL if there is a memory allocation error.
--------------------------------------------------------------------------------
luaL_openlibs
[-0, +0, m]
void luaL_openlibs (lua_State *L);
Opens all standard Lua libraries into the given state.
--------------------------------------------------------------------------------
luaL_optint
[-0, +0, v]
int luaL_optint (lua_State *L, int narg, int d);
If the function argument narg is a number, returns this number cast to an int. If this argument is absent or is nil, returns d. Otherwise, raises an error.
--------------------------------------------------------------------------------
luaL_optinteger
[-0, +0, v]
lua_Integer luaL_optinteger (lua_State *L,
int narg,
lua_Integer d);
If the function argument narg is a number, returns this number cast to a lua_Integer. If this argument is absent or is nil, returns d. Otherwise, raises an error.
--------------------------------------------------------------------------------
luaL_optlong
[-0, +0, v]
long luaL_optlong (lua_State *L, int narg, long d);
If the function argument narg is a number, returns this number cast to a long. If this argument is absent or is nil, returns d. Otherwise, raises an error.
--------------------------------------------------------------------------------
luaL_optlstring
[-0, +0, v]
const char *luaL_optlstring (lua_State *L,
int narg,
const char *d,
size_t *l);
If the function argument narg is a string, returns this string. If this argument is absent or is nil, returns d. Otherwise, raises an error.
4. The auxiliary library
Начните с самого начала
