| 433 | |
| 434 | |
| 435 | static int loader_preload (lua_State *L) { |
| 436 | const char *name = luaL_checkstring(L, 1); |
| 437 | lua_getfield(L, LUA_ENVIRONINDEX, "preload"); |
| 438 | if (!lua_istable(L, -1)) |
| 439 | luaL_error(L, LUA_QL("package.preload") " must be a table"); |
| 440 | lua_getfield(L, -1, name); |
| 441 | if (lua_isnil(L, -1)) /* not found? */ |
| 442 | lua_pushfstring(L, "\n\tno field package.preload['%s']", name); |
| 443 | return 1; |
| 444 | } |
| 445 | |
| 446 | |
| 447 | static const int sentinel_ = 0; |
nothing calls this directly
no test coverage detected