Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Lua Help - tables - Gideros Forum

Lua Help - tables

I'm try to make an array of objects to hold my box2d objects, but I'm new to lua and not sure how to do this.

Here is an example of what I'm wanting to do.


local my_objects = {}
for i = 0, 9 do

my_objects[i].body = world:createBody(
my_objects[i].shape = b2.CircleShape.new(0,0, radius)

-- etc.

end

But I get the error: "attempt to index field '?' (a nil value)"

I assume it's something to do with my .body and .shape not being setup correctly but I'm not sure how to do it and also not even familar enough with Lua to know how to search google for an answer because I don't know what these things are... is my_objects a Table ... what is the .body part of the table, a property or a field?

Thanks in advanced!
Tagged:

Comments

Sign In or Register to comment.