[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: constants?
- From: "Vincent Penquerc'h" <Vincent.Penquerch@...>
- Date: Tue, 7 Oct 2003 11:04:57 +0100
> Does lua support preprocessor constants? I'm guessing no by the
> archived notes I did see. As a lua newbie, is there a
> technical reason
> it's not supported?
Simple because Lua has no preprocessor.
However, cpp (the C (and C++) preprocessor) isn't really tied to a
C and C++ compiler. My scripts are all cpp processed, so I can use
things like #define, but also #ifdef, etc. Just add a call to cpp
(or gcc -E, or whatever your compiler is) before calling luac. Of
course, it becomes hairy if you want to use non precompiled sources,
like typing them on the fly, and you can't really do these things
on an embedded system, etc. YMMV.
You could also use m4, though cpp is more widely known.