LUAL_REGISTER(3) | Library Functions Manual | LUAL_REGISTER(3) |
luaL_register
—
opens a library, function indicator [- (0|1), +1,
m]
#include
<lauxlib.h>
void
luaL_register
(lua_State
*L, const char
*libname, const luaL_Reg
*l);
luaL_register
()
opens a library.
When called with libname equal to
NULL
, it simply registers all functions in the list
l (see luaL_Reg(3)) into the table
on the top of the stack.
When called with a non-null libname,
luaL_register 3
creates a new table t, sets it as
the value of the global variable libname, sets it as
the value of package.loaded[libname], and registers on it
all functions in the list l. If there is a table in
package.loaded[libname] or in variable
libname, reuses this table instead of creating a new
one.
In any case the function leaves the table on the top of the stack.
Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes, Lua 5.1 Reference Manual.
The luaL_register
() manual page is based
on Lua Reference Manual 5.1 and was created by Sergey Bronnikov.
July 21, 2022 | Debian |