[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Array access indirection
- From: Klaus Ripke <paul-lua@...>
- Date: Sun, 21 Sep 2008 15:43:10 +0200
On Sun, Sep 21, 2008 at 11:51:08AM +0100, Tim Channon wrote:
> rt={}
>
> rt[var]={[pa1]=va1}
>
> rt[var]={[pa2]=va2} -- does not add pair
right, this assigns a new table to rt[var].
try rt[var][pa2]=va2 to set more values in the existing table.
to set multiple values in rt[var] one would use:
if not rt[var] then rt[var] = {} end
local t = rt[var] -- now is the same table, not a copy
t[pa1]=va1 -- thus values go to rt[var]
t[pa2]=va2
cheers