Make 2 objects switch place when clicked

How do I make object A and B to switch place if i first click A then on B.
Anyone help here please?
Thanks [import]uid: 134147 topic_id: 24000 reply_id: 324000[/import]

soooo many ways to skin a cat, but:
have a table hold your information like a struct

local swapStore = {}
swapStore.objAx = 0
swapStore.objAy = 0
swapStore.objBx = 0
swapStore.objBy = 0

then when the first object is touched, stuff the coords in swapStore.objAx and y respectively, and second in swapStore.objB then call a function that swaps them, or do it inline, whichever…

ObjectA.x = swapStore.objBx
etc, etc,

remember, this is just one way… [import]uid: 21331 topic_id: 24000 reply_id: 96729[/import]