diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-02-28 12:58:48 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-02-28 12:58:48 -0300 |
| commit | d6143b1d7b44f0cc83202ee473f314a2d56372c0 (patch) | |
| tree | a993c0fd2eff6b18c61480319143b4f658b4789c | |
| parent | d55bb795faaa3a632aeb92fd29fc12b796ae7968 (diff) | |
| download | lua-d6143b1d7b44f0cc83202ee473f314a2d56372c0.tar.gz lua-d6143b1d7b44f0cc83202ee473f314a2d56372c0.tar.bz2 lua-d6143b1d7b44f0cc83202ee473f314a2d56372c0.zip | |
avoid access to undefined global variables
| -rw-r--r-- | loadlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: loadlib.c,v 1.16 2005/01/14 14:17:18 roberto Exp roberto $ | 2 | ** $Id: loadlib.c,v 1.17 2005/02/18 12:40:02 roberto Exp roberto $ |
| 3 | ** Dynamic library loader for Lua | 3 | ** Dynamic library loader for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | * | 5 | * |
| @@ -298,7 +298,8 @@ static int loader_Lua (lua_State *L) { | |||
| 298 | const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); | 298 | const char *fname = luaL_gsub(L, name, ".", LUA_DIRSEP); |
| 299 | const char *path; | 299 | const char *path; |
| 300 | /* try first `LUA_PATH' for compatibility */ | 300 | /* try first `LUA_PATH' for compatibility */ |
| 301 | lua_getglobal(L, "LUA_PATH"); | 301 | lua_pushstring(L, "LUA_PATH"); |
| 302 | lua_rawget(L, LUA_GLOBALSINDEX); | ||
| 302 | path = lua_tostring(L, -1); | 303 | path = lua_tostring(L, -1); |
| 303 | if (!path) { | 304 | if (!path) { |
| 304 | lua_pop(L, 1); | 305 | lua_pop(L, 1); |
