Assigning myName to an element in an array causes an error?

1
2
firstCrate =  #allCrates[1]
firstCrate.myName = "crate1"

the error is not in firstCrate.myName = "crate1"
but in firstCrate =  #allCrates[1]

what is #allCrates[1] ?
if allCrates is a table #allCrates is number of elements in it.
so not sure what you are expecting to get from #allCrates[1].
is it a multidimensional table ?

have you declared firstCrate somewhere ?
just try local firstCrate =  #allCrates[1]

Thanks for the response..

it's an array defined as:

1
        local allCrates = {} 

will you be creating multiple crates in a loop ?

if you do like this

1
2
local firstCrate =  allCrates[1]
firstCrate.myName = "crate1"

notts_forest_,

the problem is the first line itself, even if you defined it as local.. or global.

1
2
firstCrate =  #allCrates[1]
firstCrate.myName = "crate1"
views:1367 update:2011/9/27 18:14:54
corona forums © 2003-2011