assert and non-string errors
Closed this issue · 3 comments
daurnimator commented
compat53 should override assert
to allow non-string errors.
$ lua5.1 -l compat53
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> assert(nil, setmetatable({}, { __tostring=function() return "asdf" end }))
stdin:1: bad argument #2 to 'assert' (string expected, got table)
stack traceback:
[C]: ?
[C]: in function 'assert'
stdin:1: in main chunk
[C]: ?
$ lua5.2 -l compat53
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> assert(nil, setmetatable({}, { __tostring=function() return "asdf" end }))
stdin:1: bad argument #2 to 'assert' (string expected, got table)
stack traceback:
[C]: in function 'assert'
stdin:1: in main chunk
[C]: in ?
$ lua
Lua 5.3.1 Copyright (C) 1994-2015 Lua.org, PUC-Rio
> assert(nil, setmetatable({}, { __tostring=function() return "asdf" end }))
asdf
Thanks to @Darkstalker for reminding me.
daurnimator commented
Thanks; prompt as always :D
daurnimator commented
Hey @siffiejoe, can you make a new release with this fix in it? Thanks :)