event.isCtrlDown

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

Overview

Indicates if the Control key was held down at the time the key event occurred. Note that this property is guaranteed to return true if the key that was just pressed down was leftCtrl or rightCtrl.

Example

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

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