For simple numeric data some approach as below could be used
local col = vmath.vector4(math.random(), math.random(), math.random(), 1)
factory.create("#factory", nil, nil, { color = col })
-- object.script
go.property("color", vmath.vector4())
function init(self)
go.set("#sprite", "tint", self.color)
end
Multiple values if they are number can be added to that table too
local data = { size = 10, cost = 100 }
factory.create("#factory", nil, nil, data)
-- object.script
go.property("size", 1)
go.property("cost", 10)
function init(self)
-- process data
end
But what to do with strings data? How do you pass it to such objects? What about some data that is table itself?