query objects dynamicly instead of getting a string?!

    for a = 1, 3 do

        StarPos[a] = (“level.bodies.StarPos”…a)

    end

So, I’ ve got this Problem, where I got Position objects coming from a svg file and I get it, when I call it like this “level.bodies.StarPos1” ( level.bodies.StarPos2 /  level.bodies.StarPos3) 

but when I try it like above, it obviously becomes a string. How can I get the Object instead of the string?

Thanks a lot

Just move the quotation marks.

 for a = 1, 3 do StarPos[a] = level.bodies["StarPos"..a] end

The only part you want to concatenate is “StarPos” and the number, so you only need the quotes when indexing the object inside the “bodies” table. You still want level and bodies to be tables, not strings, so don’t put quotation marks around them.

WOW. thanks a lot. This makes everything so much easier…!

Thank you very much!!

Just move the quotation marks.

 for a = 1, 3 do StarPos[a] = level.bodies["StarPos"..a] end

The only part you want to concatenate is “StarPos” and the number, so you only need the quotes when indexing the object inside the “bodies” table. You still want level and bodies to be tables, not strings, so don’t put quotation marks around them.

WOW. thanks a lot. This makes everything so much easier…!

Thank you very much!!