aboutsummaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/lua.c b/lua.c
index 8d2671a0..b25e1c1f 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.144 2005/05/17 19:49:15 roberto Exp roberto $ 2** $Id: lua.c,v 1.145 2005/06/03 20:16:16 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*/
@@ -148,13 +148,16 @@ static const char *get_prompt (lua_State *L, int firstline) {
148 148
149 149
150static int incomplete (lua_State *L, int status) { 150static int incomplete (lua_State *L, int status) {
151 if (status == LUA_ERRSYNTAX && 151 if (status == LUA_ERRSYNTAX) {
152 strstr(lua_tostring(L, -1), LUA_QL("<eof>")) != NULL) { 152 size_t lmsg;
153 lua_pop(L, 1); 153 const char *msg = lua_tolstring(L, -1, &lmsg);
154 return 1; 154 const char *tp = msg + lmsg - (sizeof(LUA_QL("<eof>")) - 1);
155 if (strstr(msg, LUA_QL("<eof>")) == tp) {
156 lua_pop(L, 1);
157 return 1;
158 }
155 } 159 }
156 else 160 return 0; /* else... */
157 return 0;
158} 161}
159 162
160 163