Essentially,
What a player touches the screen you set a table (called clickLocation in this example) to the co-ordinates of the click (e.g.
{x: 4, y: 6}). You then start a timer to a time that is just over the time it takes for the player to send another touch event if they are holding the mouse. If another touch happens while the timer is running you reset the timer and clickLocation. When the user stops dragging the timer event happens, so you could call a drag event or run a function with the coordinates of clickLocation.
Here's some non tested example code:
There's probably a typo or error in it, but you get the general idea. Again, I haven't tested it, but it should work. It only fires when the drag is complete, but you could easily change it so it fired on every move.
local dragStartLocation = {}
local clickLocation = {}
local dragTimer = nil
while true do
local event, arg1, arg2, arg3, arg4 = os.pullEvent()
if event == "monitor_touch" then
if not dragStartLocation then
dragStartLocation = {x: arg2, y: arg3}
end
clickLocation = {x: arg2, y: arg3}
dragTimer = os.startTimer(0.1) --i havent tested this value, it will need experimentation
elseif event == "timer" and arg1 == dragTimer then
os.queueEvent("monitor_drag",dragStartLocation["x"], dragStartLocation["y"], clickLocation["x"], clickLocation["y"])
elseif event == "monitor_drag" then
print("Drag from ("..arg1..", "..arg2..") to ("..arg1..", "..arg2..")")
end
end