lua-users home
lua-l archive

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



On 19-Aug-04, at 7:37 PM, David Given wrote:
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 { ... }
}

Perhaps you need a different syntax. The one you are using might even be
construed to be confusing; it might tempt someone to write:

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

However, you should be able to use the __add metamethod I proposed earlier:

  module { app { ... } + app {...} }

Technically this could be module ( app {...} + app {...} ) but mixing () and {} is probably too confusing, so module would probably want to unwrap the table.