Conditionally load Lua package library (for native libs)
This commit is contained in:
parent
6d821cb361
commit
2211193a96
18
src/luaapi.c
18
src/luaapi.c
@ -3381,13 +3381,17 @@ void luaapi_init() {
|
|||||||
|
|
||||||
k3Log(k3_DEBUG, "Loading Lua stdlib");
|
k3Log(k3_DEBUG, "Loading Lua stdlib");
|
||||||
|
|
||||||
luaL_requiref(L, "_G", luaopen_base, 1);
|
size_t numpkgs = 0;
|
||||||
luaL_requiref(L, LUA_TABLIBNAME, luaopen_table, 1);
|
numpkgs++, luaL_requiref(L, "_G", luaopen_base, 1);
|
||||||
luaL_requiref(L, LUA_STRLIBNAME, luaopen_string, 1);
|
numpkgs++, luaL_requiref(L, LUA_TABLIBNAME, luaopen_table, 1);
|
||||||
luaL_requiref(L, LUA_MATHLIBNAME, luaopen_math, 1);
|
numpkgs++, luaL_requiref(L, LUA_STRLIBNAME, luaopen_string, 1);
|
||||||
luaL_requiref(L, LUA_DBLIBNAME, luaopen_debug, 1);
|
numpkgs++, luaL_requiref(L, LUA_MATHLIBNAME, luaopen_math, 1);
|
||||||
luaL_requiref(L, LUA_UTF8LIBNAME, luaopen_utf8, 1);
|
numpkgs++, luaL_requiref(L, LUA_DBLIBNAME, luaopen_debug, 1);
|
||||||
lua_pop(L, 6);
|
numpkgs++, luaL_requiref(L, LUA_UTF8LIBNAME, luaopen_utf8, 1);
|
||||||
|
#ifdef LUAAPI_EXPOSE_PACKAGE_LIB
|
||||||
|
numpkgs++, luaL_requiref(L, "package", luaopen_package, 1);
|
||||||
|
#endif
|
||||||
|
lua_pop(L, numpkgs);
|
||||||
|
|
||||||
k3Log(k3_DEBUG, "Setting custom require");
|
k3Log(k3_DEBUG, "Setting custom require");
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user