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

"'Martin Eden' via lua-l" <[email protected]> Thu, 30 Jul 2026 18:42:48 +0200
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
On 2026-07-30 18:05, mathieu stumpf-guntz wrote:
> Not sure what you mean here, but in my previous examples I didn=E2=80=99t=
 mean=20
> I used any magic sequence, the "\n" was actually literal new lines. So=20
> to make it clear, the test conducted was more like `echo -e=20
> '[[\ntest\n]]' | lua`,=C2=A0 which ends up (in all configurations I was=
=20
> able to try) with
> lua: stdin:3: unexpected symbol near '[[test
> ]]'

Well that's a different thing! It gives same error for me too.

So as

 =C2=A0 $ echo -e '123' | lua
 =C2=A0 lua: stdin:1: unexpected symbol near '123'

What result you expect?

"lua" program in interactive mode silently places expressions
inside "print()". That's neat feature to use it as calculator.

But neither "[[\ntest\n]]" nor "123" is valid Lua code:
they are expressions, not statements.

-- 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/0fbb4=
6f7-e923-4080-b426-547241e1a83f%40disroot.org.