lua-users home
lua-l archive

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


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