registry._LOADED created "on demand"

This commit is contained in:
Roberto Ierusalimschy
2005-10-03 11:36:45 -03:00
parent 5fc92cce12
commit e41fb9a604
2 changed files with 4 additions and 4 deletions

View File

@@ -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 */