! Tap Once (touch.tap)
Declaration
touch.tap(x, y [, holdMs, waitAfterMs ])
Parameters
- x, y
Integers. Coordinates of the tap point in the current rotated coordinate system. - holdMs
Integer, optional. Time between touch down and lift up in milliseconds. Default: 30. - waitAfterMs
Integer, optional. Extra wait time after the tap finishes in milliseconds. Default: 0.
Notes
Simulates a single tap at the specified position.
This call may yield; before it returns, other threads may get a chance to run.
Note: During the call, a finger id is allocated and occupied automatically. The pool size is limited (about 30). If you exceed the limit and call touch.on or touch.tap again, afinger pool overflow
error will be thrown. Avoid simultaneously occupying too many finger ids, and release them promptly with:off
.
Example
touch.tap(100, 100) -- tap position 100,100
touch.tap(100, 100, 300) -- press at 100,100, hold 0.3s, then lift
touch.tap(100, 100, 300, 1000) -- press 0.3s, lift, then wait 1s more