diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.173 2014/06/19 18:29:30 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.174 2014/06/26 17:25:11 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -839,7 +839,12 @@ static int loadlib (lua_State *L) { | |||
839 | }; | 839 | }; |
840 | lua_State *L1 = getstate(L); | 840 | lua_State *L1 = getstate(L); |
841 | int i; | 841 | int i; |
842 | luaL_requiref(L1, "package", luaopen_package, 1); | 842 | luaL_requiref(L1, "package", luaopen_package, 0); |
843 | lua_assert(lua_type(L1, -1) == LUA_TTABLE); | ||
844 | /* 'requiref' should not reload module already loaded... */ | ||
845 | luaL_requiref(L1, "package", NULL, 1); /* seg. fault if it reloads */ | ||
846 | /* ...but should return the same module */ | ||
847 | lua_assert(lua_compare(L1, -1, -2, LUA_OPEQ)); | ||
843 | luaL_getsubtable(L1, LUA_REGISTRYINDEX, "_PRELOAD"); | 848 | luaL_getsubtable(L1, LUA_REGISTRYINDEX, "_PRELOAD"); |
844 | for (i = 0; libs[i].name; i++) { | 849 | for (i = 0; libs[i].name; i++) { |
845 | lua_pushcfunction(L1, libs[i].func); | 850 | lua_pushcfunction(L1, libs[i].func); |