lua-users home
lua-l archive

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

I tried it. It seems OK using the VC compiler

cl /EP /Dassert= test.lua

test.lua contains




which I think is close to what you want.


On 5/10/07, David Burgess <> wrote:
You could also try the C preprocessor.

On 5/10/07, David Haley <> wrote:
> Hi all,
> Is there a 'good' way of removing assertions from code at run/compile
> time? I want to keep them around in the source so that I can use them
> for debugging, but I'd also like to turn them off to make things as fast
> as possible (I am testing something for performance). I poked around in
> the mailing list archives and on Google but didn't see anything.
> Ideally, everything inside the assert would simply disappear, so that
> the error message would not have to be constructed either.
> For instance, this entire statement should just disappear:
> assert(self.assignment[var] == nil, "var '" .. var .. "' already had
> value '" .. (self.assignment[var] or "nil") .. "'")
> One solution would be to preprocess the source using e.g. a perl script
> and pipe that to luac. Then I would run from source when debugging and
> from bytecode when timing. Is this a reasonable idea?
> Thanks,
> - David
> --
> ~David-Haley