diff options
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 | ||
