Corona / LUA array structure question

you must first create a row before you can access it.

for example, if given this as a starting condition:

local t = { { a=1, b=2, c=3 }, { a=2, b=3, c=4 } }

then the following assignments will work:

t[1].d = 1234567 t[2].d = 2345678

because both rows t[1] and t[2] already exist as tables, and new keys (“d”) can be created within those row tables.

however the following assignment will NOT work:

t[3].d = 3456789

because row 3 does NOT yet exist, so trying to access key “d” in a non-existent table is an error.

instead you must first create row 3, THEN assign to “d”, as follows:

t[3] = {} t[3].d = 3456789