lua-users home
lua-l archive

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


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