using constants for "_LOADED" and "PRELOAD"

This commit is contained in:
Roberto Ierusalimschy
2016-12-04 18:17:24 -02:00
parent beec5af201
commit b2aa2ba046
5 changed files with 34 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: ltests.c,v 2.209 2015/10/12 16:38:19 roberto Exp roberto $
** $Id: ltests.c,v 2.210 2016/11/07 12:38:35 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@@ -869,7 +869,7 @@ static int loadlib (lua_State *L) {
luaL_requiref(L1, "package", NULL, 1); /* seg. fault if it reloads */
/* ...but should return the same module */
lua_assert(lua_compare(L1, -1, -2, LUA_OPEQ));
luaL_getsubtable(L1, LUA_REGISTRYINDEX, "_PRELOAD");
luaL_getsubtable(L1, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
for (i = 0; libs[i].name; i++) {
lua_pushcfunction(L1, libs[i].func);
lua_setfield(L1, -2, libs[i].name);