Skip to main content

Lift finger from screen (:off)

Declaration

te:off([ x, y ])

Parameters

  • x, y
    Integer, optional. Coordinates where the finger leaves the screen in the current rotation coordinate system. Default: current touch event coordinates recorded by te.

Returns

  • te
    Touch event object itself. You can get a touch event object via touch.on.

Description

Simulate lifting the finger from the current or specified position. This call releases the current touch event object.
Coordinate parameters follow the coordinate system initialized via screen.init.
It will also release the finger id occupied by the touch event object returned by touch.on.
You can also call it in the following forms (finger ID must be 1 ~ 29):

touch.off(finger_id)
touch.off(finger_id, x, y)

Example

touch.on(100, 100):off() -- touch at 100,100 then lift at current position

touch.on(100, 100):off(105, 95) -- touch at 100,100 then lift at 105,95

-- Another usage
touch.on(1, 100, 100) -- finger #1 touches at 100,100
for i=1, 100 do -- move finger #1 step by step to 100,200
touch.move(1, 100, 100 + i)
end
touch.off(1) -- lift finger #1