summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lua.c b/lua.c
index 3f7093f7..ad4e8c28 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.187 2010/02/18 19:18:41 roberto Exp roberto $ 2** $Id: lua.c,v 1.188 2010/02/27 21:15:36 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*/
@@ -219,7 +219,7 @@ static int dostring (lua_State *L, const char *s, const char *name) {
219 219
220 220
221static int dolibrary (lua_State *L, const char *name) { 221static int dolibrary (lua_State *L, const char *name) {
222 lua_getfield(L, LUA_ENVIRONINDEX, "require"); 222 lua_getglobal(L, "require");
223 lua_pushstring(L, name); 223 lua_pushstring(L, name);
224 return report(L, docall(L, 1, 1)); 224 return report(L, docall(L, 1, 1));
225} 225}
@@ -227,7 +227,7 @@ static int dolibrary (lua_State *L, const char *name) {
227 227
228static const char *get_prompt (lua_State *L, int firstline) { 228static const char *get_prompt (lua_State *L, int firstline) {
229 const char *p; 229 const char *p;
230 lua_getfield(L, LUA_ENVIRONINDEX, firstline ? "_PROMPT" : "_PROMPT2"); 230 lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
231 p = lua_tostring(L, -1); 231 p = lua_tostring(L, -1);
232 if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); 232 if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
233 lua_pop(L, 1); /* remove global */ 233 lua_pop(L, 1); /* remove global */
@@ -301,7 +301,7 @@ static void dotty (lua_State *L) {
301 report(L, status); 301 report(L, status);
302 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */ 302 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */
303 luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); 303 luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
304 lua_getfield(L, LUA_ENVIRONINDEX, "print"); 304 lua_getglobal(L, "print");
305 lua_insert(L, 1); 305 lua_insert(L, 1);
306 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK) 306 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK)
307 l_message(progname, lua_pushfstring(L, 307 l_message(progname, lua_pushfstring(L,
@@ -319,7 +319,7 @@ static int handle_script (lua_State *L, char **argv, int n) {
319 int status; 319 int status;
320 const char *fname; 320 const char *fname;
321 int narg = getargs(L, argv, n); /* collect arguments */ 321 int narg = getargs(L, argv, n); /* collect arguments */
322 lua_setfield(L, LUA_ENVIRONINDEX, "arg"); 322 lua_setglobal(L, "arg");
323 fname = argv[n]; 323 fname = argv[n];
324 if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) 324 if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
325 fname = NULL; /* stdin */ 325 fname = NULL; /* stdin */