lua-users home
lua-l archive

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


Nikolai Kondrashov wrote:
Hello everyone,

I wasn't able to find an answer to a seemingly basic question anywhere:
Is it possible to disable "assert" function execution along with its
argument evaluation in Lua? I.e. like it is done in C by defining NDEBUG?

Could it be done with the parser ignoring "assert" calls and subsequently
not producing any bytecode for it?

Or maybe there are some other approaches, which I missed?

Thank you :)

Sincerely,
Nick

"assert" isn't a keyword in lua so it isn't treated any differently to any other function.

It could be done via metalua or modifying lua's source etc, but at that point you should really make assert a reserved word as redefining assert (ie to change the error handling) would no longer be possible.

- Alex