natiny.input.get_mouse_button_down

Lua
natiny.input.get_mouse_button_down(button) -> boolean

Returns true if the specified mouse button is currently held down.

Parameters

Name Type Description
button number Mouse button - a natiny.input.MOUSE_BUTTON_* constant, e.g. natiny.input.MOUSE_BUTTON_LEFT

Returns

Type Description
boolean true if the button is held, false otherwise

Example

Lua
if natiny.input.get_mouse_button_down(natiny.input.MOUSE_BUTTON_LEFT) then
    drag()
end

Notes

  • Returns true every frame as long as the button is held.
  • Use mouse_button_pressed to detect the moment the button is first pressed.