lua-users home
lua-l archive

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

On 20 November 2011 01:04, Patrick Donnelly <> wrote:
> I would hope not. Why would error call the __tostring metamethod on an object?
> --
> - Patrick Donnelly

error doesn't; the lua interpreter's main pcall prints off any
un-caught errors: currently if the error isn't a string, you just get:
lua: (error object is not a string)
It would be nice if it did a tostring() on the error message; so that
you could use error objects with a __tostring metamethod: error (
setmetatable({"Failure is ","an option"},{__tostring=table.concat})


It is the same way in luajit and 5.2