lua-users home
lua-l archive

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


On Sat, Nov 19, 2011 at 4:37 AM, HyperHacker <hyperhacker@gmail.com> wrote:
> On Sat, Nov 19, 2011 at 02:32, Daurnimator <quae@daurnimator.com> wrote:
>> I just noticed that the __tostring metamethod is not invoked when an
>> error is at the top level in both luajit and lua:
>>
>> error(setmetatable({},{__tostring=function(o) return "My error msg" end;})
>>
>> This seems like bad beahviour to me.... makes custom error objects a bit harder.
>>
>>
>
> Isn't this fixed in 5.2?

I would hope not. Why would error call the __tostring metamethod on an object?

-- 
- Patrick Donnelly