MyObject[i] ???

Hi

I’ve recently discovered Corona …

I need to create mutliple object but they need to have a unique Id

unfortunaly this doesn’t work

  
for i=10 do  
  
local My["Object"..i] = display.newImage("images/bt-"..btnum..".png")  
.....  
  
end  
  

Any way to do that ??

[import]uid: 12522 topic_id: 4602 reply_id: 304602[/import]

local objects={}  
for i=1,10 do  
 local object=display.newImage("images/bt-"..i..".png")  
 object.id=i  
 objects[i]=object  
end  

if you want to refer to the 7th object’s id, use objects[7].id [import]uid: 6459 topic_id: 4602 reply_id: 14569[/import]

Thanks a lot [import]uid: 12522 topic_id: 4602 reply_id: 14609[/import]

for i=10 do  

isn’t correct syntax. You probably want

for i=1, 10 do  

https://docs.google.com/document/pub?id=1FzdK7-woueGMxjnqPY3bjeFAu8b6mCgndui2NlwPu3s&pli=1 [import]uid: 12108 topic_id: 4602 reply_id: 14517[/import]