Re: Inconsistent Multiline String Handling in Lua REPL (Direct Input vs. History Recall)

"'Martin Eden' via lua-l" <[email protected]> Thu, 30 Jul 2026 17:42:04 +0200
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
On 2026-07-30 14:01, mathieu stumpf-guntz wrote:
>
> In Lua REPL, direct input of multiline strings fails with a syntax=20
> error, while recalling the same input via history navigation (up=20
> arrow) executes correctly. This behavior is observed starting from Lua=20
> 5.3.x. In Lua 5.2.4, history navigation as a feature did not exist, so=20
> the issue cannot be verified in earlier versions.
>
> *Steps to Reproduce:*
>
> 1.
>
>     Launch Lua REPL (tested versions: 5.2.4, 5.3.6, 5.5.0).
>
> 2.
>
>     Input a multiline string directly:
>
>     > [[ \ntest\n]]
>
>     Output: stdin:3: unexpected symbol near '[[test\n]]'=C2=A0(error in a=
ll
>     tested versions).
>
> 3.
>
>     Press the up arrow to recall and re-execute the same input.
>
Works on my machine:

 =C2=A0 $ lua
 =C2=A0 Lua 5.5.1=C2=A0 Copyright (C) 1994-2026 Lua.org, PUC-Rio
 =C2=A0 > [[ \ntest\n]]
 =C2=A0 =C2=A0\ntest\n
 =C2=A0 >

BTW there are no magic (cursed) sequences in long Lua literals.

-- Martin


--=20
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 e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/472e6=
add-8c07-41e0-9a40-6acdfb796eac%40disroot.org.