Re: Minor typo in error message

"'TopchetoEU' via lua-l" <[email protected]> Mon, 13 Jul 2026 04:13:15 +0000
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
On Sunday, 12 July 2026 22:27:37 EEST Roberto Ierusalimschy wrote:
> > In Lua 5.5 when you try to use string with invalid
> > escape sequence -- error message lacks closing quote.
> > 
> > For example let's try invalid escape code "\c":
> > 
> >   Lua 5.5.0  Copyright (C) 1994-2025 Lua.org, PUC-Rio
> >   > '\c'
> >   stdin:1: invalid escape sequence near ''\c'
> > 
> > I believe it should end on "''\c''".
> 
> The closing quote is not part of the invalid escape sequence, why it
> must be in the error message?  Note that the closing quote can be
> 
> quite far away, or it may not even exist:
>   > '\caaaaaaaaaaaaaaaaaaaaaaaaaa'
> 
>   stdin:1: invalid escape sequence near ''\c'
> 
>   > '\caaaaaaaaaaaaaaaaaaa
> 
>   stdin:1: invalid escape sequence near ''\c'
> 
> Lua stops reading as soon as it finds an error.
> 
> -- Roberto
> 
> ---

I'm not sure how much this is within the realm of possibility, but would it 
make sense to quote the erroneous part of the source like this: `'bad escape 
\c`, so that one doesn't get confused by the repeated single quotes?




-- 
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/3pGlhNXVQmGINJnuiM-dgA%40topcheto.eu.