diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-31 17:23:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-31 17:23:40 -0300 |
commit | f0b3cd1d6f35ba34091450d5e3057269114a17b6 (patch) | |
tree | ceffcf31f1823709b7ab4e63801e5e483abf8490 /lua.c | |
parent | fb5e6d5ac498649b8e1b6bf068d18078ef70d523 (diff) | |
download | lua-f0b3cd1d6f35ba34091450d5e3057269114a17b6.tar.gz lua-f0b3cd1d6f35ba34091450d5e3057269114a17b6.tar.bz2 lua-f0b3cd1d6f35ba34091450d5e3057269114a17b6.zip |
new API functions `pop', `insert', and `move'
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.47 2000/08/29 14:33:31 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.48 2000/08/31 14:28:17 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 | */ |
@@ -87,7 +87,9 @@ static void laction (int i) { | |||
87 | static int ldo (int (*f)(lua_State *l, const char *), const char *name) { | 87 | static int ldo (int (*f)(lua_State *l, const char *), const char *name) { |
88 | int res; | 88 | int res; |
89 | handler h = lreset(); | 89 | handler h = lreset(); |
90 | int top = lua_gettop(L); | ||
90 | res = f(L, name); /* dostring | dofile */ | 91 | res = f(L, name); /* dostring | dofile */ |
92 | lua_settop(L, top); /* remove eventual results */ | ||
91 | signal(SIGINT, h); /* restore old action */ | 93 | signal(SIGINT, h); /* restore old action */ |
92 | if (res == LUA_ERRMEM) { | 94 | if (res == LUA_ERRMEM) { |
93 | /* Lua gives no message in such case, so lua.c provides one */ | 95 | /* Lua gives no message in such case, so lua.c provides one */ |
@@ -177,9 +179,9 @@ static void manual_input (int version, int prompt) { | |||
177 | const char *s; | 179 | const char *s; |
178 | lua_getglobal(L, "_PROMPT"); | 180 | lua_getglobal(L, "_PROMPT"); |
179 | s = lua_tostring(L, -1); | 181 | s = lua_tostring(L, -1); |
180 | lua_settop(L, -1); /* remove global */ | ||
181 | if (!s) s = PROMPT; | 182 | if (!s) s = PROMPT; |
182 | fputs(s, stdout); | 183 | fputs(s, stdout); |
184 | lua_pop(L, 1); /* remove global */ | ||
183 | } | 185 | } |
184 | for(;;) { | 186 | for(;;) { |
185 | int c = getchar(); | 187 | int c = getchar(); |