[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Array access indirection
- From: "Mark Meijer" <meijer78@...>
- Date: Sun, 21 Sep 2008 05:50:54 +0200
2008/9/21 Javier Guerra Giraldez <javier@guerrag.com>:
> On Saturday 20 September 2008, David Manura wrote:
>> On Sat, Sep 20, 2008 at 8:45 PM, Tim Channon wrote:
>> > Can Lua do this? Add from a variable variable data to an
>> > existing array (table) of an array (table) in a variable of an
>> > exiting array (table) in a variable.
>>
>> Not sure if I parsed that correctly, but does this do what you need?
>
> it's certainly unreadable; but i guess hes asking something that would be
> solved just using a variable as index to a table.
I don't exactly understand the specific example you gave, but it
appears to boil down to the question if there are any restrictions on
table composition and index expressions. The title of this thread
leads me to suspect that it's about keys.
AFAIK, any keys present in a table constructor have to be immediate
values. At any other place, you can use any expression you like to
access tables (aside from some exceptions, such as nil, or keywords or
symbols as names when using the dot notation).
And of course, any table can be a key (or a value, for that matter) in
any other table (but again, in table constructors, any keys have to be
immediate values, e.g. another table constructor).
Hope this covers it.
Cheers