[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: errors needs to be tostring()'d
- From: Daurnimator <quae@...>
- Date: Sun, 20 Nov 2011 01:11:44 +1100
On 20 November 2011 01:04, Patrick Donnelly <batrick@batbytes.com> 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})
See http://www.lua.org/source/5.1/lua.c.html#report
It is the same way in luajit and 5.2