I’m trying to read and then create objects in a for loop. The problem is that, the algorithm below is probably overwriting the same object because when I try to pull the data, it gives the same ID. How can I solve this issue?
I’m using OWL library. It is an early stage, so I’m open to any other OOP library suggestions.
Any help would be appreciated.
[lua]for key, data in pairs(levelData.objects) do
local object = owl.instance {from = GameObject}
object:setPNGImage(data.src)
object:getImage().x = data.x
object:getImage().y = data.y
object:setID(data.id)
object:setSoundOnClick(data.soundOnClick)
table.insert(loadedImages, object)
end[/lua] [import]uid: 154911 topic_id: 32255 reply_id: 332255[/import]