event.isAltDown

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

Overview

Indicates if the Alt 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 either leftAlt or rightAlt.

Example

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

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