lua-users home
lua-l archive

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


Tony Finch wrote:
> On Fri, 12 Sep 2008, David Given wrote:
>> - Lua doesn't have a preprocessor. My app was made up of multiple source
>> files, and most of the time I wanted the same common header at the top
>> of each source file (importing C functions, mostly). Many's the time I
>> wished for #include.
> 
> It's a dynamic language, so you achieve something like that by calling a
> global function which sets up the namespace at run time.

Yes, except that these are all local variables, which means they're
lexical and don't exist in a namespace.

All my Lua files tend to start with the same boilerplate containing
lists of:

local string_find = string.find
local table_insert = table.insert
local print = print

...etc. It would be really nice to be able to common this somehow.

-- 
David Given
dg@cowlark.com