[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: errors needs to be tostring()'d
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 21 Nov 2011 11:13:02 -0200
> 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