[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug report: string escapes can mess up terminal
- From: nobody <nobody+lua-list@...>
- Date: Wed, 16 Aug 2017 04:00:55 +0200
On 2017-08-16 03:07, Soni L. wrote:
On 08/16/2017 12:34 AM, Soni L. wrote:
"hello \x1b[33m \u{"
"\x1b[1;3;4;7;32mHi!"
I'm of the opinion that error messages containing control codes should
be an error.
So what should happen? Escape some (all?) non-printable characters?
But maybe keep NL? HT? CR?
What about \0? That currently terminates error messages:
> "foo\0bar \u{"
stdin:1: hexadecimal digit expected near '"foo'
> error "foo\0bar"
stdin:1: foo
stack traceback:
[...]
OTOH, I _do_ like my
Error = { __tostring = function( e ) return e.msg end }
function oops( msg )
return error( setmetatable( {
msg = "\x1b[1;7;31m OOPS \x1b[0;31m "..msg.."\x1b[0m",
reason = "panic",
}, Error ) )
end
oops "things just went horribly wrong"
so this should only affect Lua's own error messages.
-- nobody