| 448 | |
| 449 | |
| 450 | static int loader_preload (lua_State *L) { |
| 451 | const char *name = luaL_checkstring(L, 1); |
| 452 | lua_getfield(L, LUA_ENVIRONINDEX, "preload"); |
| 453 | if (!lua_istable(L, -1)) |
| 454 | luaL_error(L, LUA_QL("package.preload") " must be a table"); |
| 455 | lua_getfield(L, -1, name); |
| 456 | if (lua_isnil(L, -1)) /* not found? */ |
| 457 | lua_pushfstring(L, "\n\tno field package.preload['%s']", name); |
| 458 | return 1; |
| 459 | } |
| 460 | |
| 461 | |
| 462 | static const int sentinel_ = 0; |
nothing calls this directly
no test coverage detected