[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3: assert non-string values in #2 cause `(no error message)`-style error message
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 20 Oct 2014 08:34:08 +0200
On Mon, Oct 20, 2014 at 6:46 AM, Andrew Starks <andrew.starks@trms.com> wrote:
> I don't know if this has broad potential for others, or not, but an error
> would be welcomed here, as well. This time for having any value that is not
> a string or `nil` in assert's second argument would have saved me hours of
> head scratching. Not having a line number/file name was very...difficult.
Well, one option is: if the error is not a string, then try to call
tostring() on it. Then we can have error objects with __tostring
defined appropriately.
'nil' can either be a special case or simply an error, as Roberto suggests.
steve d.