Skip to main content

Scroll the hardware mouse wheel (:scroll)

This method is available in versions after 20260805

Declaration​

success, error_message = mouse_obj:scroll(delta_x, delta_y)

Parameters​

  • delta_x
    Integer. Scroll steps in the range [-127, 127]; positive values scroll right.
  • delta_y
    Integer. Scroll steps in the range [-127, 127]; positive values scroll up.

Returns​

  • success
    Boolean. true if scrolling succeeds; otherwise false.
  • error_message
    String. The reason scrolling failed.

Description​

Scroll amounts are not pixels. The system and apps may scale the actual scrolling distance according to their own settings. Out-of-range values raise a Lua argument error.

Example​

local m = assert(mouse.connect())
assert(m:scroll(0, 10))
assert(m:disconnect())