event.isPrimaryButtonDown

Type Boolean
Event mouse
Revision Release 2024.3703
Keywords mouse, isPrimaryButtonDown

Overview

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

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

Example

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