lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 2017-08-16 03:07, Soni L. wrote:
On 08/16/2017 12:34 AM, Soni L. wrote:
"hello \x1b[33m \u{"

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 ) )
oops "things just went horribly wrong"

so this should only affect Lua's own error messages.

-- nobody