[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: behaviour of assert on non-string errors
- From: Elias Barrionovo <elias.tandel@...>
- Date: Fri, 17 Jan 2014 14:33:04 -0200
On Fri, Jan 17, 2014 at 2:19 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> Seems like it would be nicer if assert respected __tostring, as error does.
> Whenever I think this, someone explains a great answer for it. In three,
> two, one...
I always thought assert() called error() internally. Why isn't it the
case? Apart maybe from the stacktrace, isn't the following function
equivalent to assert()?
-- untested
function myAssert(cond, ...)
if cond then
return cond, ...
else
error(...)
end
end
--
NI!
() - www.asciiribbon.org
/\ - ascii ribbon campaign against html e-mail and proprietary attachments