MCPcopy Create free account
hub / github.com/DFHack/dfhack / createsearcherstable

Function createsearcherstable

depends/lua/src/loadlib.c:733–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731
732
733static void createsearcherstable (lua_State *L) {
734 static const lua_CFunction searchers[] =
735 {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL};
736 int i;
737 /* create 'searchers' table */
738 lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0);
739 /* fill it with predefined searchers */
740 for (i=0; searchers[i] != NULL; i++) {
741 lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */
742 lua_pushcclosure(L, searchers[i], 1);
743 lua_rawseti(L, -2, i+1);
744 }
745#if defined(LUA_COMPAT_LOADERS)
746 lua_pushvalue(L, -1); /* make a copy of 'searchers' table */
747 lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */
748#endif
749 lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */
750}
751
752
753/*

Callers 1

luaopen_packageFunction · 0.85

Calls 5

lua_createtableFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushcclosureFunction · 0.85
lua_rawsetiFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected