Skip to main content

Move the hardware mouse (:move)

This method is available in versions after 20260805

Declaration​

success, error_message = mouse_obj:move(dx, dy)

Parameters​

  • dx
    Integer. Relative horizontal movement in the range [-2047, 2047]; positive values move right and negative values move left.
  • dy
    Integer. Relative vertical movement in the range [-2047, 2047]; positive values move down and negative values move up.

Returns​

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

Description​

Move once relative to the current pointer position. The interface does not automatically split movement beyond the supported range. Out-of-range values raise a Lua argument error.

Example​

local m = assert(mouse.connect())
assert(m:move(100, -50))
assert(m:disconnect())