| 673 | |
| 674 | |
| 675 | static void createsearcherstable (lua_State *L) { |
| 676 | static const lua_CFunction searchers[] = |
| 677 | {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; |
| 678 | int i; |
| 679 | /* create 'searchers' table */ |
| 680 | lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); |
| 681 | /* fill it with pre-defined searchers */ |
| 682 | for (i=0; searchers[i] != NULL; i++) { |
| 683 | lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */ |
| 684 | lua_pushcclosure(L, searchers[i], 1); |
| 685 | lua_rawseti(L, -2, i+1); |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | |
| 690 | LUAMOD_API int luaopen_package (lua_State *L) { |
no test coverage detected