Touch Simulation (touch)
touch
Touch simulation: tap, swipe, pinch, multi-touch, streaming touch events via HID.
23 functions
Lua 5.3
touch.touch.double_tap
touch.double_tap(x, y)Simulate double tap.
touch.touch.hold_and_drag
touch.hold_and_drag(x1, y1, x2, y2 [, hold_ms, drag_ms])Hold at position then drag to another.
touch.touch.init
touch.init(orientation)Set touch coordinate orientation.
touch.touch.init_home_on_bottom
touch.init_home_on_bottom()Set touch orientation to portrait.
touch.touch.init_home_on_left
touch.init_home_on_left()Set touch orientation to landscape (home left).
touch.touch.init_home_on_right
touch.init_home_on_right()Set touch orientation to landscape (home right).
touch.touch.init_home_on_top
touch.init_home_on_top()Set touch orientation to upside-down portrait.
touch.touch.is
touch.is(value)Check if value is a touch_stream userdata.
touch.touch.long_press
touch.long_press(x, y [, duration_ms])Simulate long press.
touch.touch.move
touch.move(stream_or_finger, x, y)Move touch. Stream form: interpolated path with step_len/step_delay. Finger form: instant move.
touch.touch.multi_tap
touch.multi_tap(x, y, count [, interval_ms])Tap N times at same position.
touch.touch.off
touch.off(stream_or_finger [, x, y])End touch (finger up). Unlocks finger from pool.
touch.touch.on
touch.on(x, y) | touch.on(fingerId, x, y)Touch down (start touch event). Returns chainable touch_event object.
touch.touch.orientation
touch.orientation()Get current touch orientation.
touch.touch.pinch
touch.pinch(cx, cy, startR, endR [, duration_ms])Pinch gesture (zoom in/out).
touch.touch.random_swipe
touch.random_swipe(x1, y1, x2, y2 [, variation, duration])Swipe with random path variation.
touch.touch.random_tap
touch.random_tap(x1, y1, x2, y2)Tap at random point within rectangle.
touch.touch.rotate_xy
touch.rotate_xy(x, y, target)Rotate touch coordinates between orientations.
touch.touch.show_pose
touch.show_pose(enabled)Show/hide visual touch indicators on screen.
touch.touch.size
touch.size()Get native screen size for touch coordinates.
touch.touch.swipe
touch.swipe(x1, y1, x2, y2 [, duration_ms])Simulate swipe gesture.
touch.touch.tap
touch.tap(x, y [, holdMs, waitAfterMs])Simulate single tap at coordinates.
touch.touch.two_finger_tap
touch.two_finger_tap(x, y)Two-finger tap gesture.