event.isSecondaryButtonDown

Type Boolean
Event mouse
Revision Release 2024.3703
Keywords mouse, isSecondaryButtonDown

Overview

Indicates if the mouse’s secondary button was held down at the time the mouse event occurred.

Note that the secondary button is typically the right mouse button, unless the end-user has had it swapped with the left mouse button.

Gotchas

Android devices older than version 4.0 do not support the secondary mouse button. This property will always be set false for those older devices.

Example

-- Called when a mouse event has been received.
local function onMouseEvent( event )
    if event.isSecondaryButtonDown then
        -- The mouse's secondary/right button is currently pressed down.
    else
        -- The mouse's secondary/right button is not being pressed.
    end
end
                             
-- Add the mouse event listener.
Runtime:addEventListener( "mouse", onMouseEvent )