[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table constructions
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sun, 5 Mar 2006 16:39:23 -0300
> I'm trying to modify Lua so that a table constructed as:
>
> t = { weight = 9, wibble, foo }
>
> results in a table as:
>
> { weight = 9, wibble = true, foo = true }
>
> I've been playing around with the code in lparser.c, but I'm not having
> much success (this is the first time I've done any hacking on Lua).
There is no need to hack the parser. You can set an __index metamethod
for _G that returns true for undefined global variables. This will do
what you wish but perhaps it's much more that we you want...
--lhf