How to Reuse objects

if I do

a = display.newCircle(x,y,r)
b = a
b.x = x1

then I am also doing

a.x = x1

and then a and b are in the same position

how can I change b.x without changing a.x at the same time?

I want to have lots of circles in different positions without having to do

display.newCircle()

for each one.

Note that the "circle"is only an example, I want to know this and apply it to a more complicated objects that I want to generate using rectangles and circles.

Thanks for any help on this
[import]uid: 41639 topic_id: 8996 reply_id: 308996[/import]

You are only creating one single object there so naturally when you change b.x you will be changing the position of it. You will want to create more than one circle object, or whatever your final object will be.

To do this you will most likely want to use tables and a loop, something like this:

[code]

local objects = {}

for i = 1, 20, 1 do
objects[i] = display.newCircle(0, 0, 20)
end

objects[5].x = 50
objects[7].x = 20
[/code] [import]uid: 5833 topic_id: 8996 reply_id: 33262[/import]

Thanks Graham
[import]uid: 41639 topic_id: 8996 reply_id: 33315[/import]

No problem. [import]uid: 5833 topic_id: 8996 reply_id: 33365[/import]