diff options
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.222 2014/11/11 19:41:27 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.223 2015/03/09 21:57:05 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 | */ |
@@ -313,11 +313,11 @@ static int pushline (lua_State *L, int firstline) { | |||
313 | lua_pop(L, 1); /* remove prompt */ | 313 | lua_pop(L, 1); /* remove prompt */ |
314 | l = strlen(b); | 314 | l = strlen(b); |
315 | if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ | 315 | if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ |
316 | b[l-1] = '\0'; /* remove it */ | 316 | b[--l] = '\0'; /* remove it */ |
317 | if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ | 317 | if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ |
318 | lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ | 318 | lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ |
319 | else | 319 | else |
320 | lua_pushstring(L, b); | 320 | lua_pushlstring(L, b, l); |
321 | lua_freeline(L, b); | 321 | lua_freeline(L, b); |
322 | return 1; | 322 | return 1; |
323 | } | 323 | } |