Hello dear Lua community,
In Lua REPL, direct input of multiline strings fails with a syntax
error, while recalling the same input via history navigation (up arrow)
executes correctly. This behavior is observed starting from Lua 5.3.x.
In Lua 5.2.4, history navigation as a feature did
not exist, so the issue cannot be verified in earlier versions.
Steps to Reproduce:
Launch Lua REPL (tested versions: 5.2.4, 5.3.6, 5.5.0).
Input a multiline string directly:
Output: stdin:3: unexpected symbol near '[[test\n]]' (error in all tested versions).
Press the up arrow to recall and re-execute the same input.
Lua 5.2.4: History navigation feature did not exist.
Lua 5.3.6+: Output: test (correct).
Environment where this was tested:
Lua Versions: 5.2.4, 5.3.6, 5.5.0
Shells: fish 3.7.0/4.8.1, bash 3.2.57(1)-release/5.2.21
Terminal Emulator: JetBrains-JediTerm/Gnome Terminal
OS: macOS 26.5.2 (arm64)/Ubuntu 24.04.4 LTS
Observations:
Direct input of multiline strings fails consistently across all tested versions.
History recall of the same multiline strings works in Lua 5.3.6+ but was not available in 5.2.4.
The issue suggests a discrepancy in how the REPL processes direct input versus history recall.
Suggestion:
The fix should ensure consistent interpretation of multiline strings regardless of input method (direct or history recall).
Works on my machine:
$ lua
Lua 5.5.1 Copyright (C) 1994-2026 Lua.org, PUC-Rio
> [[ \ntest\n]]
\ntest\n
>
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/72c88ccc-765c-4d7f-9b19-cf6d5b4a509fn%40googlegroups.com.