Implementing 2 Dimensional array + Table Error!!

I dont know if this is possible or not but when I try to initialize a two dimensional array and add a table inside it gives me an error.

ex.

array[row][col] = display.newRect(x,x,x,x)
array[row][col].table = value

and i get an error.

Does anybody experienced this? and found a solution thanks! I need this badly [import]uid: 225774 topic_id: 36171 reply_id: 336171[/import]

Usually when I run into this problem it is because I’m not initializing a table in array[row] before adding something to array[row][col]. You tend to need something like this:

local array = {}  
for row = 1, 100, 1 do  
 array[row] = {}   
 for col = 1, 100, 1 do  
 array[row][col] = display.newRect(x,x,x,x)  
 array[row][col].table = value  
 end  
end  

If you still get the error then you probably need to add array[row][col].table = {} before setting it equal to value. [import]uid: 99903 topic_id: 36171 reply_id: 143662[/import]

Thanks dyson, I will try this. [import]uid: 225774 topic_id: 36171 reply_id: 143663[/import]

Usually when I run into this problem it is because I’m not initializing a table in array[row] before adding something to array[row][col]. You tend to need something like this:

local array = {}  
for row = 1, 100, 1 do  
 array[row] = {}   
 for col = 1, 100, 1 do  
 array[row][col] = display.newRect(x,x,x,x)  
 array[row][col].table = value  
 end  
end  

If you still get the error then you probably need to add array[row][col].table = {} before setting it equal to value. [import]uid: 99903 topic_id: 36171 reply_id: 143662[/import]

Thanks dyson, I will try this. [import]uid: 225774 topic_id: 36171 reply_id: 143663[/import]

Usually when I run into this problem it is because I’m not initializing a table in array[row] before adding something to array[row][col]. You tend to need something like this:

local array = {}  
for row = 1, 100, 1 do  
 array[row] = {}   
 for col = 1, 100, 1 do  
 array[row][col] = display.newRect(x,x,x,x)  
 array[row][col].table = value  
 end  
end  

If you still get the error then you probably need to add array[row][col].table = {} before setting it equal to value. [import]uid: 99903 topic_id: 36171 reply_id: 143662[/import]

Thanks dyson, I will try this. [import]uid: 225774 topic_id: 36171 reply_id: 143663[/import]

Usually when I run into this problem it is because I’m not initializing a table in array[row] before adding something to array[row][col]. You tend to need something like this:

local array = {}  
for row = 1, 100, 1 do  
 array[row] = {}   
 for col = 1, 100, 1 do  
 array[row][col] = display.newRect(x,x,x,x)  
 array[row][col].table = value  
 end  
end  

If you still get the error then you probably need to add array[row][col].table = {} before setting it equal to value. [import]uid: 99903 topic_id: 36171 reply_id: 143662[/import]

Thanks dyson, I will try this. [import]uid: 225774 topic_id: 36171 reply_id: 143663[/import]