diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-07-01 11:26:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-07-01 11:26:28 -0300 |
commit | 80ec81926c19ff638a65088bb3d5a55d20b55945 (patch) | |
tree | 6630fe28b6b20f83fd69ad64bc71fa4bc546b491 /lua.c | |
parent | 96917ff42a7867e72629d6cd39c818df4c250b91 (diff) | |
download | lua-80ec81926c19ff638a65088bb3d5a55d20b55945.tar.gz lua-80ec81926c19ff638a65088bb3d5a55d20b55945.tar.bz2 lua-80ec81926c19ff638a65088bb3d5a55d20b55945.zip |
`lua.c' also needs the default path, so auxlib should provide it
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 14 |
1 files changed, 4 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.127 2004/06/16 20:22:43 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.128 2004/06/17 14:06:52 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 | */ |
@@ -143,15 +143,9 @@ static int dostring (const char *s, const char *name) { | |||
143 | 143 | ||
144 | 144 | ||
145 | static int load_file (const char *name) { | 145 | static int load_file (const char *name) { |
146 | lua_getglobal(L, "require"); | 146 | name = luaL_searchpath(L, name, NULL); |
147 | if (!lua_isfunction(L, -1)) { /* no `require' defined? */ | 147 | if (name == NULL) return report(1); |
148 | lua_pop(L, 1); | 148 | else return file_input(name); |
149 | return file_input(name); | ||
150 | } | ||
151 | else { | ||
152 | lua_pushstring(L, name); | ||
153 | return report(lcall(1, 1)); | ||
154 | } | ||
155 | } | 149 | } |
156 | 150 | ||
157 | 151 | ||