Skip to main content

Press with force on screen (:press)

Declaration

te = te:press([ pressure, speed ])

Parameters

  • pressure
    Integer, optional. Pressure range 1~10000. Default: 1000.
  • speed
    Integer, optional. Apply pressure speed, range 1~100. Default: fastest.

Returns

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

Notes

  • Simulate applying pressure at current position. Only available on devices that support 3D Touch.
  • This method may yield; before it returns, other threads may get a chance to run.

Example

touch.on(100, 100):press():off() -- touch 100,100 then press and lift

touch.on(100, 100):press(2000):off() -- same with stronger pressure

touch.on(100, 100):press(2000, 50):off() -- stronger pressure, slower press speed