MultiDimensional Arrays

I’m kind of new to Corona and I’m working with a multi dimensional array that stores tiles for a puzzle game I’m working with.

My code looks like this:

local randomTile = getRandomTile()  
 tiles[column][row] = display.newImageRect(munches[randomTile], 34, 34)  
 tiles[column][row].y = -row \* 34   
 tiles[column][row].x = x  
 tiles[column][row].column = column  
 tiles[column][row].row = row  
 tiles[column][row].tile = randomTile  
 tiles[column][row].remove = false  
 tiles[column][row].check = false  
 tiles[column][row].touch = tileTouched  
 tiles[column][row]:addEventListener("touch", tiles[column][row])  

Is it okay to add new properties to each element like I did here with the column, row, tile, remove, check?

Also if it’s fine, what happens when I replace a tile with another?

 tiles[1][2] = tiles[2][2]  

Do all of the properties transfer as well or just the newImageRect?

Thanks! [import]uid: 54776 topic_id: 22301 reply_id: 322301[/import]

easy way to test - copy then print the other properties see if they change.

:slight_smile:

c. [import]uid: 24 topic_id: 22301 reply_id: 88935[/import]

Yeah I’ll give it a try in a few days hopefully after I catch up with my other work. Had a long weekend of coding for the 48 hour challenge (Techority). Lots of fun! [import]uid: 54776 topic_id: 22301 reply_id: 89914[/import]

After a short break I began trying things out with some print statements. It looks like all properties do copy on over with a direct assignment which makes things much easier. Just means my bug is some place else. :stuck_out_tongue:

Thanks Carlos. [import]uid: 54776 topic_id: 22301 reply_id: 90578[/import]