[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: assert with any type as message (like error)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 2 Jul 2014 09:24:14 -0300
> Unfortunately, it is not possible with assert, you *must* pass a string.
> I think it can be great to also have assert working like error so the
This is supported in Lua 5.3.0 (work3).
For Lua 5.2, you can simply redefine assert:
function assert(cond,...)
if cond then
return cond,...
else
error(...)
end
end
This is how assert is implemented in 5.3.