[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Disabling assert function
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 20 May 2010 13:53:26 -0300
> function assertc(condn,fun)
> if not condn then assert(false,fn()) end
> end
Here's an assert on esteroids that can be used to avoid concatenations
for instance:
do
local old_assert=assert
function assert(cond,what,...)
if cond then
return what,...
else
if type(what)=="function" then
old_assert(cond,what())
elseif type(what)=="string" then
if ...==nil then
old_assert(cond,what)
else
old_assert(cond,what:format(...))
end
end
end
end
end
- References:
- Disabling assert function, Nikolai Kondrashov
- Re: Disabling assert function, Alex Davies
- Re: Disabling assert function, Nikolai Kondrashov
- Re: Disabling assert function, steve donovan
- Re: Disabling assert function, Nikolai Kondrashov
- Re: Disabling assert function, HyperHacker
- Re: Disabling assert function, Nikolai Kondrashov
- Re: Disabling assert function, Marc OMorain
- Re: Disabling assert function, Romulo
- Re: Disabling assert function, steve donovan