lua-users home
lua-l archive

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


> > 1. Static (compile-time) asserts
> In my previous message I forgot to mention that case 4 will appear in any
> large-scale production code in any programming language, IMO. For example, I've done
> very little programming in Java (J2ME games), and even in that small project we found
> the C preprocessor to be the only solution to add/remove some code in Debug/Release
> builds. Maybe I haven't done enough production code in Lua yet to encounter the same
> case (but I know that others have, namely Ivan-Assen Ivanov who has complained here
> about the lack of Debug-build-only asserts in Lua).

Just for the record, for the game we shipped recently with tons of Lua
code we used LHF's assert-removing code
(http://article.gmane.org/gmane.comp.lang.lua.general/39222) in a
custom Lua compiler, which precompiled all the scripts at build time.
We toyed with the idea of replacing references to values held in
certain global tables used for storing gameplay constants with the
values themselves, but there were technical problems (the information
about the concrete values wasn't readily available to the custom Lua
compiler at the moment of compilation), and brief tests showed no
noticeable performance gain.

Assen