MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaL_openlibs

Function luaL_openlibs

third-party/lua-5.2.4/src/linit.c:52–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50
51
52LUALIB_API void luaL_openlibs (lua_State *L) {
53 const luaL_Reg *lib;
54 /* call open functions from 'loadedlibs' and set results to global table */
55 for (lib = loadedlibs; lib->func; lib++) {
56 luaL_requiref(L, lib->name, lib->func, 1);
57 lua_pop(L, 1); /* remove lib */
58 }
59 /* add open functions from 'preloadedlibs' into 'package.preload' table */
60 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
61 for (lib = preloadedlibs; lib->func; lib++) {
62 lua_pushcfunction(L, lib->func);
63 lua_setfield(L, -2, lib->name);
64 }
65 lua_pop(L, 1); /* remove _PRELOAD table */
66}
67

Callers 1

pmainFunction · 0.70

Calls 3

luaL_requirefFunction · 0.70
luaL_getsubtableFunction · 0.70
lua_setfieldFunction · 0.70

Tested by

no test coverage detected