Skip to content

Engine.input

The mouse. For keys and buttons as they are pressed, see the player_input event.

Functions

Engine.input.getMouseButton

local heldFrames, released = Engine.input.getMouseButton(button)

Returns the state of a mouse button: the number of frames it has been held, 0 when it is up, and whether it was released on this frame. button is "left", "middle", "right" or "x1" to "x5".

Engine.input.getMouseMovement

local x, y = Engine.input.getMouseMovement()

Returns how far the mouse moved on this frame. Positive y is up. Call it from a frame event; elsewhere it repeats the values of the last frame.

Engine.input.getMouseWheel

local notches = Engine.input.getMouseWheel()

Returns how many notches the wheel turned on this frame. The sign gives the direction.