summaryrefslogtreecommitdiff
path: root/lua.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-03-10 11:15:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-03-10 11:15:06 -0300
commitfd6e680e2161ea4511c395edddc84de2134fcb93 (patch)
tree11315bcf7e75d3fc703c51b19c95de3812fff0f4 /lua.c
parent57c0db219b9ee48d951adf68a577b4eec5309e57 (diff)
downloadlua-github-fd6e680e2161ea4511c395edddc84de2134fcb93.tar.gz
detail
Diffstat (limited to 'lua.c')
-rw-r--r--lua.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lua.c b/lua.c
index a0e04c8e..706bcf23 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
/*
-** $Id: lua.c,v 1.222 2014/11/11 19:41:27 roberto Exp roberto $
+** $Id: lua.c,v 1.223 2015/03/09 21:57:05 roberto Exp roberto $
** Lua stand-alone interpreter
** See Copyright Notice in lua.h
*/
@@ -313,11 +313,11 @@ static int pushline (lua_State *L, int firstline) {
lua_pop(L, 1); /* remove prompt */
l = strlen(b);
if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
- b[l-1] = '\0'; /* remove it */
+ b[--l] = '\0'; /* remove it */
if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */
lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */
else
- lua_pushstring(L, b);
+ lua_pushlstring(L, b, l);
lua_freeline(L, b);
return 1;
}