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

mathieu stumpf-guntz <[email protected]> Thu, 30 Jul 2026 05:01:50 -0700 (PDT)
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
------=_Part_58812_427708027.1785412910778
Content-Type: multipart/alternative; 
	boundary="----=_Part_58813_981657432.1785412910778"

------=_Part_58813_981657432.1785412910778
Content-Type: text/plain; charset="UTF-8"



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:*

   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]]' (error in all 
   tested versions).
   3. 
   
   Press the up arrow to recall and re-execute the same input.
   
Note on reproduction:

   1. 
      - 
      
      *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).
Kind regards,
Matheiu

-- 
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 [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/3b309f19-3774-487c-b50d-2c73aff5ec22n%40googlegroups.com.

------=_Part_58813_981657432.1785412910778
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<p style=3D"text-align: left; text-indent: 0px; text-transform: none;"><spa=
n style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12p=
t;">Hello dear Lua community,</span></p><p style=3D"text-align: left; text-=
indent: 0px; text-transform: none;"><span style=3D"font-family: Aptos, Aria=
l, Helvetica, sans-serif; font-size: 12pt;"><br />
In Lua REPL, direct input of multiline strings fails with a syntax=20
error, while recalling the same input via history navigation (up arrow)=20
executes correctly. This behavior is observed starting from Lua 5.3.x.=20
In Lua 5.2.4, history navigation as a feature did
 not exist, so the issue cannot be verified in earlier versions.</span></p>
<p style=3D"text-align: left; text-indent: 0px; text-transform: none;"><spa=
n style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12p=
t;"><b>Steps to Reproduce:</b></span></p>
<ol start=3D"1" style=3D"text-align: left;"><li style=3D"font-family: Aptos=
, Arial, Helvetica, sans-serif; font-size: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Launch Lua R=
EPL (tested versions: 5.2.4, 5.3.6, 5.5.0).</span></p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Input a mult=
iline string directly:</span></p>
<span role=3D"presentation"><div><span style=3D"text-transform: none;"><spa=
n> &gt; [[ \ntest\n]]</span></span></div></span>
<p role=3D"presentation"><span style=3D"text-transform: none;">Output: <spa=
n>stdin:3: unexpected symbol near '[[test\n]]'</span>=C2=A0(error in all te=
sted versions).</span></p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Press the up=
 arrow to recall and re-execute the same input.</span></p></li></ol><div>No=
te on reproduction:</div><ol start=3D"1" style=3D"text-align: left;"><li><u=
l><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-size:=
 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;"><b>Lua 5.2.4=
</b>: History navigation feature did not exist.</span></p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;"><b>Lua 5.3.6=
+</b>: Output:
<span>test</span>=C2=A0(correct).</span></p>
</li></ul></li></ol>
<p style=3D"text-align: left; text-indent: 0px; text-transform: none;"><spa=
n style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12p=
t;"><b>Environment where this was tested:</b></span></p>
<ul style=3D"text-align: left;"><li style=3D"font-family: Aptos, Arial, Hel=
vetica, sans-serif; font-size: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Lua Versions=
: 5.2.4, 5.3.6, 5.5.0</span></p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Shells: <spa=
n>fish 3.7.0/4.8.1</span>,
<span>bash 3.2.57(1)-release/</span></span>5.2.21</p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Terminal Emu=
lator: JetBrains-JediTerm/Gnome Terminal</span></p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">OS: macOS 26=
.5.2 (arm64)/</span>Ubuntu 24.04.4 LTS</p>
</li></ul>
<p style=3D"text-align: left; text-indent: 0px; text-transform: none;"><spa=
n style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12p=
t;"><b>Observations:</b></span></p>
<ul style=3D"text-align: left;"><li style=3D"font-family: Aptos, Arial, Hel=
vetica, sans-serif; font-size: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">Direct input=
 of multiline strings fails consistently across all tested versions.</span>=
</p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">History reca=
ll of the same multiline strings works in Lua 5.3.6+ but was not available =
in 5.2.4.</span></p>
</li><li style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-si=
ze: 12pt;">
<p role=3D"presentation"><span style=3D"text-transform: none;">The issue su=
ggests a discrepancy in how the REPL processes direct input versus history =
recall.</span></p>
</li></ul>
<p style=3D"text-align: left; text-indent: 0px; text-transform: none;"><spa=
n style=3D"font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12p=
t;"><b>Suggestion:</b><br />
The fix should ensure consistent interpretation of multiline strings regard=
less of input method (direct or history recall).</span></p>
<div style=3D"direction: ltr; font-family: Aptos, Arial, Helvetica, sans-se=
rif; font-size: 12pt;">Kind regards,<br />Matheiu</div>
<br />

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;lua-l&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">lua-l+unsubsc=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
lua-l/3b309f19-3774-487c-b50d-2c73aff5ec22n%40googlegroups.com?utm_medium=
=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/lua-l/3b309=
f19-3774-487c-b50d-2c73aff5ec22n%40googlegroups.com</a>.<br />

------=_Part_58813_981657432.1785412910778--

------=_Part_58812_427708027.1785412910778--