MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / luaopen_package

Function luaopen_package

ThirdParty/lua/lua/loadlib.c:762–785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

760
761
762LUAMOD_API int luaopen_package (lua_State *L) {
763 createclibstable(L);
764 luaL_newlib(L, pk_funcs); /* create 'package' table */
765 createsearcherstable(L);
766 /* set field 'path' */
767 setpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, LUA_PATH_DEFAULT);
768 /* set field 'cpath' */
769 setpath(L, "cpath", LUA_CPATHVARVERSION, LUA_CPATH_VAR, LUA_CPATH_DEFAULT);
770 /* store config information */
771 lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
772 LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
773 lua_setfield(L, -2, "config");
774 /* set field 'loaded' */
775 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
776 lua_setfield(L, -2, "loaded");
777 /* set field 'preload' */
778 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
779 lua_setfield(L, -2, "preload");
780 lua_pushglobaltable(L);
781 lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */
782 luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */
783 lua_pop(L, 1); /* pop global table */
784 return 1; /* return 'package' table */
785}
786

Callers

nothing calls this directly

Calls 7

createclibstableFunction · 0.85
createsearcherstableFunction · 0.85
setpathFunction · 0.85
lua_setfieldFunction · 0.85
luaL_getsubtableFunction · 0.85
lua_pushvalueFunction · 0.85
luaL_setfuncsFunction · 0.85

Tested by

no test coverage detected