| 731 | |
| 732 | |
| 733 | static 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 | /* |
no test coverage detected