diff options
-rw-r--r-- | lua.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.95 2002/07/09 18:19:44 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.96 2002/07/10 20:44:34 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 | */ |
@@ -218,7 +218,6 @@ static int incomplete (int status) { | |||
218 | 218 | ||
219 | static int load_string (void) { | 219 | static int load_string (void) { |
220 | int status; | 220 | int status; |
221 | int moreinput = 1; | ||
222 | lua_settop(L, 0); | 221 | lua_settop(L, 0); |
223 | if (read_line(get_prompt(1)) == 0) /* no input? */ | 222 | if (read_line(get_prompt(1)) == 0) /* no input? */ |
224 | return -1; | 223 | return -1; |
@@ -228,10 +227,10 @@ static int load_string (void) { | |||
228 | } | 227 | } |
229 | for (;;) { /* repeat until gets a complete line */ | 228 | for (;;) { /* repeat until gets a complete line */ |
230 | status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); | 229 | status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin"); |
231 | if (!moreinput || !incomplete(status)) /* cannot try to add lines? */ | 230 | if (!incomplete(status)) break; /* cannot try to add lines? */ |
232 | break; | ||
233 | lua_pushliteral(L, "\n"); /* no; add line separator */ | 231 | lua_pushliteral(L, "\n"); /* no; add line separator */ |
234 | moreinput = read_line(get_prompt(0)); | 232 | if (read_line(get_prompt(0)) == 0) /* no more input? */ |
233 | return -1; | ||
235 | lua_concat(L, lua_gettop(L)); /* join lines and line separator */ | 234 | lua_concat(L, lua_gettop(L)); /* join lines and line separator */ |
236 | } | 235 | } |
237 | save_line(lua_tostring(L, 1)); | 236 | save_line(lua_tostring(L, 1)); |