summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lua.c b/lua.c
index e1084f3b..071bc5b9 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.175 2009/08/10 16:23:19 roberto Exp roberto $ 2** $Id: lua.c,v 1.176 2009/11/24 18:05:12 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*/
@@ -151,7 +151,7 @@ static int dostring (lua_State *L, const char *s, const char *name) {
151 151
152 152
153static int dolibrary (lua_State *L, const char *name) { 153static int dolibrary (lua_State *L, const char *name) {
154 lua_getglobal(L, "require"); 154 lua_getfield(L, LUA_GLOBALSINDEX, "require");
155 lua_pushstring(L, name); 155 lua_pushstring(L, name);
156 return report(L, docall(L, 1, 1)); 156 return report(L, docall(L, 1, 1));
157} 157}
@@ -231,7 +231,7 @@ static void dotty (lua_State *L) {
231 report(L, status); 231 report(L, status);
232 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */ 232 if (status == LUA_OK && lua_gettop(L) > 0) { /* any result to print? */
233 luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); 233 luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
234 lua_getglobal(L, "print"); 234 lua_getfield(L, LUA_GLOBALSINDEX, "print");
235 lua_insert(L, 1); 235 lua_insert(L, 1);
236 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK) 236 if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK)
237 l_message(progname, lua_pushfstring(L, 237 l_message(progname, lua_pushfstring(L,
@@ -250,7 +250,7 @@ static int handle_script (lua_State *L, char **argv, int n) {
250 int status; 250 int status;
251 const char *fname; 251 const char *fname;
252 int narg = getargs(L, argv, n); /* collect arguments */ 252 int narg = getargs(L, argv, n); /* collect arguments */
253 lua_setglobal(L, "arg"); 253 lua_setfield(L, LUA_GLOBALSINDEX, "arg");
254 fname = argv[n]; 254 fname = argv[n];
255 if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) 255 if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
256 fname = NULL; /* stdin */ 256 fname = NULL; /* stdin */