From d6143b1d7b44f0cc83202ee473f314a2d56372c0 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 28 Feb 2005 12:58:48 -0300 Subject: avoid access to undefined global variables --- loadlib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'loadlib.c') diff --git a/loadlib.c b/loadlib.c index 1fe4fc38..d4e55255 100644 --- a/loadlib.c +++ b/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.16 2005/01/14 14:17:18 roberto Exp roberto $ +** $Id: loadlib.c,v 1.17 2005/02/18 12:40:02 roberto Exp roberto $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h * @@ -298,7 +298,8 @@ static int loader_Lua (lua_State *L) { const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); const char *path; /* try first `LUA_PATH' for compatibility */ - lua_getglobal(L, "LUA_PATH"); + lua_pushstring(L, "LUA_PATH"); + lua_rawget(L, LUA_GLOBALSINDEX); path = lua_tostring(L, -1); if (!path) { lua_pop(L, 1); -- cgit v1.2.3-55-g6feb