| 599 | |
| 600 | |
| 601 | static int searcher_preload (lua_State *L) { |
| 602 | const char *name = luaL_checkstring(L, 1); |
| 603 | lua_getfield(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); |
| 604 | if (lua_getfield(L, -1, name) == LUA_TNIL) { /* not found? */ |
| 605 | lua_pushfstring(L, "no field package.preload['%s']", name); |
| 606 | return 1; |
| 607 | } |
| 608 | else { |
| 609 | lua_pushliteral(L, ":preload:"); |
| 610 | return 2; |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | |
| 615 | static void findloader (lua_State *L, const char *name) { |
nothing calls this directly
no test coverage detected