aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-05 15:19:11 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-05 15:19:11 -0300
commit6b45ccf4ed24dcfe437cf0159d6185119a2e8f95 (patch)
tree83f0122940fcd8c3f5594172d7ae4a37a737d408
parent93fd6892f85ecd8a4e82d2339016a9f71a42d0e8 (diff)
downloadlua-6b45ccf4ed24dcfe437cf0159d6185119a2e8f95.tar.gz
lua-6b45ccf4ed24dcfe437cf0159d6185119a2e8f95.tar.bz2
lua-6b45ccf4ed24dcfe437cf0159d6185119a2e8f95.zip
Removed compatibility with "= exp" in the REPL
-rw-r--r--lua.c5
-rw-r--r--testes/main.lua2
2 files changed, 2 insertions, 5 deletions
diff --git a/lua.c b/lua.c
index bff6a8f5..3d807c98 100644
--- a/lua.c
+++ b/lua.c
@@ -565,10 +565,7 @@ static int pushline (lua_State *L, int firstline) {
565 l = strlen(b); 565 l = strlen(b);
566 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ 566 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
567 b[--l] = '\0'; /* remove it */ 567 b[--l] = '\0'; /* remove it */
568 if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ 568 lua_pushlstring(L, b, l);
569 lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */
570 else
571 lua_pushlstring(L, b, l);
572 lua_freeline(b); 569 lua_freeline(b);
573 return 1; 570 return 1;
574} 571}
diff --git a/testes/main.lua b/testes/main.lua
index 17fbcb61..7b0f4ee0 100644
--- a/testes/main.lua
+++ b/testes/main.lua
@@ -345,7 +345,7 @@ a]]
345RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) 345RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
346checkprogout("6\n10\n10\n\n") 346checkprogout("6\n10\n10\n\n")
347 347
348prepfile("a = [[b\nc\nd\ne]]\n=a") 348prepfile("a = [[b\nc\nd\ne]]\na")
349RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out) 349RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
350checkprogout("b\nc\nd\ne\n\n") 350checkprogout("b\nc\nd\ne\n\n")
351 351