sry, I rushed a bit. I figure it out
code goes like this:
function init(self)
math.randomseed(os.clock()*100000000000)
local randTable = {'#goFactory1', '#goFactory2', '#goFactory3', '#goFactory4', '#goFactory5', '#goFactory6', '#goFactory7', '#goFactory8', '#goFactory9', '#goFactory10' }
local pos = go.get_position()
factory.create(randTable[math.random(#randTable)], go.set_position(pos))
end
my problem was actually go.set_position(pos), it was supposed to be only pos instead. And console didn’t show any error, that’s what confused me.
My next step will be to implement for loop,
in that for loop (4 cycles) I need to create 4 random objects in total from randTable. My confusion now is how to avoid duplicating instances, because that random function can respawn 2 or more same instances in that 4 cycles…
I am migrating from GameMaker, apologies for confusing questions, there I would solve this with if instance_exists function. I am looking in defold API and I am not finding similiar function to compare if go exists