natiny.input.get_mouse_button_pressed

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

Returns true only on the frame when the specified mouse button was first pressed 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 on the frame the button was pressed, false otherwise

Example

Lua
if natiny.input.get_mouse_button_pressed(natiny.input.MOUSE_BUTTON_LEFT) then
    select_item()
end

Notes

  • Returns true for the frame that consumes a released-to-pressed transition.