diff options
Diffstat (limited to 'lua.c')
| -rw-r--r-- | lua.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.c,v 1.179 2009/12/17 13:07:41 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.180 2009/12/17 16:20:01 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 | */ |
| @@ -214,7 +214,7 @@ static int dostring (lua_State *L, const char *s, const char *name) { | |||
| 214 | 214 | ||
| 215 | 215 | ||
| 216 | static int dolibrary (lua_State *L, const char *name) { | 216 | static int dolibrary (lua_State *L, const char *name) { |
| 217 | lua_getfield(L, LUA_GLOBALSINDEX, "require"); | 217 | lua_getfield(L, LUA_ENVIRONINDEX, "require"); |
| 218 | lua_pushstring(L, name); | 218 | lua_pushstring(L, name); |
| 219 | return report(L, docall(L, 1, 1)); | 219 | return report(L, docall(L, 1, 1)); |
| 220 | } | 220 | } |
| @@ -222,7 +222,7 @@ static int dolibrary (lua_State *L, const char *name) { | |||
| 222 | 222 | ||
| 223 | static const char *get_prompt (lua_State *L, int firstline) { | 223 | static const char *get_prompt (lua_State *L, int firstline) { |
| 224 | const char *p; | 224 | const char *p; |
| 225 | lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); | 225 | lua_getfield(L, LUA_ENVIRONINDEX, firstline ? "_PROMPT" : "_PROMPT2"); |
| 226 | p = lua_tostring(L, -1); | 226 | p = lua_tostring(L, -1); |
| 227 | if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); | 227 | if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); |
| 228 | lua_pop(L, 1); /* remove global */ | 228 | lua_pop(L, 1); /* remove global */ |
| @@ -296,7 +296,7 @@ static void dotty (lua_State *L) { | |||
| 296 | report(L, status); | 296 | report(L, status); |
| 297 | if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */ | 297 | if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */ |
| 298 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); | 298 | luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); |
| 299 | lua_getfield(L, LUA_GLOBALSINDEX, "print"); | 299 | lua_getfield(L, LUA_ENVIRONINDEX, "print"); |
| 300 | lua_insert(L, 1); | 300 | lua_insert(L, 1); |
| 301 | if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK) | 301 | if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK) |
| 302 | l_message(progname, lua_pushfstring(L, | 302 | l_message(progname, lua_pushfstring(L, |
| @@ -315,7 +315,7 @@ static int handle_script (lua_State *L, char **argv, int n) { | |||
| 315 | int status; | 315 | int status; |
| 316 | const char *fname; | 316 | const char *fname; |
| 317 | int narg = getargs(L, argv, n); /* collect arguments */ | 317 | int narg = getargs(L, argv, n); /* collect arguments */ |
| 318 | lua_setfield(L, LUA_GLOBALSINDEX, "arg"); | 318 | lua_setfield(L, LUA_ENVIRONINDEX, "arg"); |
| 319 | fname = argv[n]; | 319 | fname = argv[n]; |
| 320 | if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) | 320 | if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) |
| 321 | fname = NULL; /* stdin */ | 321 | fname = NULL; /* stdin */ |
