how to create an table of 1000 x,y points

Hi,

can anybody tell me how to create (DIM/SET) a table (array) of 1000 points x,y

so the array will look like

id,x,y
id,x,y
id,x,y
id,x,y
id,x,y
id,x,y
etc…

At initial all these x,y needs to be set so that i can use all these 1000 points x,y
By looping true this table i can then remove/update or add a new point.

Thanks,
Jasper

[import]uid: 2734 topic_id: 304 reply_id: 300304[/import]

Try this … local pts = {} for i = 1, 1000 do local pt = {} pt.id = 0 -- set init-value pt.x = 0 -- set init-value pt.y = 0 -- set init-value pts[i] = pt end
The above code creates an “array” of tables. To access a table do:

pts[4].x = pts[4].x + 1  

HTH,
David [import]uid: 1581 topic_id: 304 reply_id: 434[/import]

Thanks David, i will try that.

[import]uid: 2734 topic_id: 304 reply_id: 440[/import]