lua-users home
lua-l archive

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


Philip Bock wrote:
> I've written a simple preprocessor in Lua, to preprocess Lua scripts.
> Basically, it implements #include and #define, so I don't have to define
> a large number of global variables for commonly used constants. (By the
> way, will I really save anything doing it this way? I assume numerical
> constants are more efficient than global variables.)

Alex Sandro wrote:
>    Just out of curiosity, why is your #include better than require()
> or loadfile()?

He added his preprocessor for #define style constants, so he needs #include
to go get those constants.

As a side note textual insertion of a lua file (#include'ing) would in fact
be different than require or loadfile because the source text would be part
of the current chunk rather than part of its own chunk (think about local
variables).