Skip to main content

Touch Down (touch.on)

Declaration​

evt = touch.on(x, y)

Parameters​

  • x, y
    Integers. Coordinates of the contact point in the current rotated coordinate system.

Returns​

  • evt
    A touch event object used to control this touch process.

Description​

Simulates touching down at the specified position and returns a touch event object to operate this touch.
Coordinate parameters follow the coordinate system initialized via screen.init.
Note: A finger ID is allocated automatically from a limited pool (about 30). Exceeding the limit when calling touch.on or touch.tap throws a finger pool overflow error. Do not keep too many finger IDs active at once; release them promptly with :off.
You may also call with an explicit finger id (must be between 1 and 29), in which case you manage the id yourself:

touch.on(fingerId, x, y)

Example​

-- Touch down at (100,100), move linearly to (200,200), then lift
touch.on(100, 100):move(200, 200):off()

-- Use explicit finger id 1
touch.on(1, 100, 100)
touch.off(1)