[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Behaviour of 'set'
- From: Mark Sibly <blitzmunter@...>
- Date: Thu, 22 Oct 2009 19:38:02 +1300
I'm currently using lua as a configuration parsing tool where users
create config files like:
I'm using meta tables to chain these together so users get a sort of
'scope hierarchy' - ie: 'inner' configs can override settings in outer
This works well for reading values but not for writing, because the
way lua works, an assignment like 'speed=100' will overwrite the outer
The behaviour I'm after would instead create a new key/value in the
inner scope if it didn't exist there already.
Is there anyway to do this without resorting to either a C function to
do the metatable set_index work, or having to littler the config files
with something like 'self.speed=100'?
Thanks in advance for any advice.