lua-users home
lua-l archive

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


Asko Kauppi wrote:
I've done it in Hamster (the Lua-based build tool) using tables. So each entry can be a number, string, or table (recursively). Only the _last_ user (the one actually reading the table) needs to 'unwrap' it, for which purpose I use:

Alas, I'm already using tables to represent a particular data value, so I can't really overload them like that!

What my program is is a makefile generator. You specify a target and a list of source files like this:

app { "one.c", "two.c", "three.c" }

You can specify global options:

app { optimisation=0, "one.c", "two.c", "three.c" }

*And* you can specify local options:

app { optimisation=3, "one.c", {optimisation=0, "two.c"}, "three.c" }

This all works fine.

What I want to do is to be able to use app {} as part of the description of another target, say module {}. So I can do:

module {
	app { ... },
	app { ... }
}

But each app {} can build multiple files, and each of those files has to find its way into module {}'s argument list...

The only thing I can think of is to have a magic keyword that only exists in the return value of app {} that signifies to module {} that that table should be implicitly flattened, but that's horrible. I'd much rather find a cleaner solution.

--
[insert interesting .sig here]