event.isCommandDown

Type Boolean
Event key
Revision Release 2024.3703
Keywords key, isCommandDown
See also event.isAltDown
event.isCtrlDown
event.isShiftDown

Overview

Indicates if the Command/⌘ or Windows key was held down at the time the key event occurred.

Example

-- Called when a key event has been received
local function onKeyEvent( event )
    if event.isCommandDown then
        -- The Command/Windows key was held down for the given key
    else
        -- The Command/Windows key was not held down for the given key
    end
    return false
end

-- Add the key event listener
Runtime:addEventListener( "key", onKeyEvent )