diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-08-30 15:35:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-08-30 15:35:14 -0300 |
commit | 7d309480dd783112aad8c4761921c4d45ec70327 (patch) | |
tree | b2fa8a177839f675e35a8ef626ac76c9dba6270b /lua.c | |
parent | bcb2cb59ac235297e6ef8153ffd414836ae38efd (diff) | |
download | lua-7d309480dd783112aad8c4761921c4d45ec70327.tar.gz lua-7d309480dd783112aad8c4761921c4d45ec70327.tar.bz2 lua-7d309480dd783112aad8c4761921c4d45ec70327.zip |
new way to handle _PATH (old LUA_PATH)
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.130 2004/07/13 19:56:44 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.131 2004/08/26 14:19:55 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -127,7 +127,12 @@ static int dostring (lua_State *L, const char *s, const char *name) { | |||
127 | 127 | ||
128 | 128 | ||
129 | static int dolibrary (lua_State *L, const char *name) { | 129 | static int dolibrary (lua_State *L, const char *name) { |
130 | name = luaL_searchpath(L, name, NULL); | 130 | lua_getfield(L, LUA_GLOBALSINDEX, "_PATH"); |
131 | if (!lua_isstring(L, -1)) { | ||
132 | l_message(progname, "global _PATH must be a string"); | ||
133 | return 1; | ||
134 | } | ||
135 | name = luaL_searchpath(L, name, lua_tostring(L, -1)); | ||
131 | if (name == NULL) return report(L, 1); | 136 | if (name == NULL) return report(L, 1); |
132 | else return dofile(L, name); | 137 | else return dofile(L, name); |
133 | } | 138 | } |