From e41fb9a60478d8598a93c235760621bf6468c2df Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 3 Oct 2005 11:36:45 -0300 Subject: [PATCH] registry._LOADED created "on demand" --- lauxlib.c | 4 ++-- loadlib.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lauxlib.c b/lauxlib.c index 07dcdb27..900f14b9 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.151 2005/08/26 17:36:32 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.152 2005/09/06 17:20:11 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -231,7 +231,7 @@ LUALIB_API void luaI_openlib (lua_State *L, const char *libname, const luaL_Reg *l, int nup) { if (libname) { /* check whether lib already exists */ - lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED"); lua_getfield(L, -1, libname); /* get _LOADED[libname] */ if (!lua_istable(L, -1)) { /* not found? */ lua_pop(L, 1); /* remove previous result */ diff --git a/loadlib.c b/loadlib.c index c97d25ed..5607897b 100644 --- a/loadlib.c +++ b/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.44 2005/09/06 17:20:25 roberto Exp roberto $ +** $Id: loadlib.c,v 1.45 2005/09/30 13:50:05 roberto Exp roberto $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -640,7 +640,7 @@ LUALIB_API int luaopen_package (lua_State *L) { LUA_EXECDIR "\n" LUA_IGMARK); lua_setfield(L, -2, "config"); /* set field `loaded' */ - lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED"); lua_setfield(L, -2, "loaded"); /* set field `preload' */ lua_newtable(L);