diff options
author | Emil Renner Berthing <esmil@mailme.dk> | 2013-12-08 14:23:01 +0100 |
---|---|---|
committer | Emil Renner Berthing <esmil@mailme.dk> | 2013-12-08 15:24:07 +0100 |
commit | 0e339a54b074c7ef5f5cc461c03aac634e92b731 (patch) | |
tree | 7a6da472496b722af5a231d4cba2815056d600a4 /lua/lua.c | |
parent | c87c5a5619b1ece8ff4522dcfb688191610526f9 (diff) | |
download | lem-0e339a54b074c7ef5f5cc461c03aac634e92b731.tar.gz lem-0e339a54b074c7ef5f5cc461c03aac634e92b731.tar.xz lem-0e339a54b074c7ef5f5cc461c03aac634e92b731.zip |
Lua 5.2.3
Diffstat (limited to 'lua/lua.c')
-rw-r--r-- | lua/lua.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.205 2012/05/23 15:37:09 roberto Exp $ +** $Id: lua.c,v 1.206.1.1 2013/04/12 18:48:47 roberto Exp $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -237,7 +237,6 @@ static const char *get_prompt (lua_State *L, int firstline) { lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); p = lua_tostring(L, -1); if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); - lua_pop(L, 1); /* remove global */ return p; } @@ -263,7 +262,9 @@ static int pushline (lua_State *L, int firstline) { char *b = buffer; size_t l; const char *prmt = get_prompt(L, firstline); - if (lua_readline(L, b, prmt) == 0) + int readstatus = lua_readline(L, b, prmt); + lua_pop(L, 1); /* remove result from 'get_prompt' */ + if (readstatus == 0) return 0; /* no input */ l = strlen(b); if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ |