IsModifierKeyDown

From Warcraft Wiki
Jump to navigation Jump to search
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsModifierKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.0.1 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsControlKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 1.0.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsShiftKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 1.0.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsAltKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 1.0.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsLeftControlKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.2.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsLeftShiftKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.2.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsLeftAltKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.2.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsRightControlKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.2.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsRightShiftKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.2.0 / 1.13.2
GitHub Octocat.png  Townlong-Yak BAD.png  ProfIcons engineering.png  Wowprogramming.png  BTNTemp.png IsRightAltKeyDown TheWarWithin-Icon-Inline.pngDragonflight-Icon-Inline.pngCata-Logo-Small.pngWrath-Logo-Small.pngWoW Icon update.png + 2.2.0 / 1.13.2

Returns true if a modifier key is currently pressed down.

isDown = IsModifierKeyDown() <- IsControlKeyDown() <- IsLeftControlKeyDown()
                                                   <- IsRightControlKeyDown()
                             <- IsShiftKeyDown()   <- IsLeftShiftKeyDown()
                                                   <- IsRightShiftKeyDown()
                             <- IsAltKeyDown()     <- IsLeftAltKeyDown()
                                                   <- IsRightAltKeyDown()

Returns

isDown
boolean - True if the specified modifier key is pressed down.

Details

Related Events MODIFIER_STATE_CHANGED
Related API IsModifiedClickGetBindingByKey

Example

Prints if the left-ctrl and left-shift modifiers are pressed down.

local function OnEvent(self, event, ...)
	if IsLeftControlKeyDown() and IsLeftShiftKeyDown() then
		print("hello")
	end
end

local f = CreateFrame("Frame")
f:RegisterEvent("MODIFIER_STATE_CHANGED")
f:SetScript("OnEvent", OnEvent)