you have so many mistakes on your code that the coordenates is the last of your problems.
why are you using runtime to add a touch event to an object?
why are you creating a new rect inside the function when you touch it??? if you want to move you just change the x and the y from that object you don’t create a new one. and if you want to move an object you need to calculate the start touch event and correct the position so when you touch an object it will not jump to the touch point.
to save to an array…create an array outside the scope and a counter, inside the scope just fill the array with the new coordenates and increment the count:
local point = display.newRect( 100,100, 10, 10 ) local array={} local count=1 local function onTouch(event) array[count]={} print("POS.X = " .. event.x, "POS.Y = ".. event.y); array[count].posX=event.x array[count].posY=event.y point.x=event.x point.y=event.y count=count+1 end Runtime:addEventListener("touch",onTouch);
note that i didn’t correct any of your problems. i just add the code needed of what you asked.