gaps between touch events??

I was trying the following idea. I want to draw a line made with custom images. So i tried this code (instead of using newImage i used newCircle, just to sketch). I’m getting all points between touch event coordinates. It only works if your movement increments positively (began touch < ended touch). This is not my problem, i know i have to change and add some things in order to get it to work all the way round.
The problem i’m getting is that when i draw the vertical line (x start position = x ending position), i get some gaps in it. Can’t understand why this happens.

main.lua
[blockcode]
local x1
local y1
local x2
local y2
local m
local b
local x
local y
drawLine = function(event)
if event.phase == “began” then
x1 = event.x
y1 = event.y
print(x1, y1)
end
if event.phase == “moved” then
x2 = event.x
y2 = event.y
if x1==x2 then
for i=y1, y2, 1 do
local point = display.newCircle(x1, i, 10)
point:setFillColor(255,0,0)
end
else
m = (y1-y2)/(x1-x2)
b = y1-m*x1
for i=x1, x2, 1 do
x = i
y = m*i+b
local point = display.newCircle(x, y, 10)
point:setFillColor(255,255,255)
end
end
x1 = x2
y1 = y2
end
end

Runtime:addEventListener(“touch”, drawLine)
[/blockcode] [import]uid: 98755 topic_id: 17546 reply_id: 317546[/import]

problem solved, how can i delete this post? [import]uid: 98755 topic_id: 17546 reply_id: 66688[/import]