[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: errors needs to be tostring()'d
- From: Daurnimator <quae@...>
- Date: Tue, 22 Nov 2011 00:22:33 +1100
On 22 November 2011 00:13, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> 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
>
> I don't think it is the same with 5.2:
>
> roberto@roberto:~/prj/lua$ lua
> Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> > error (
> >> setmetatable({"Failure is ","an option"},{__tostring=table.concat})
> >> )
> Failure is an option
>
> -- Roberto
>
>
Odd; I didn't test with 5.2; but the code for "report" in lua.c is the same :)
In this case; I spose this is something for Mike Pall to fix?