lua-users home
lua-l archive

Re: do you use the pre-processor?

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


On 2000年5月10日 rw20@cornell.edu wrote:
> Something like 
> 
> $define debugging true
> 
> function test(x)
> if debugging then
> if type(x) ~= 'table' then
> RuntimeError('x is not a table')
> end
> end
> print(x.name)
> end
I would be happy with this. I would be even happier if that were replaced
by:
function test(x)
 $assert( type(x) == 'table' )
 print(x.name)
end
You might control compiling or not-compiling the $assert function call
through the $debug macro.
F

AltStyle によって変換されたページ (->オリジナル) /