Skip to content

Instantly share code, notes, and snippets.

@GabeStah
Created March 2, 2015 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GabeStah/4e1e179b21795b46ad1a to your computer and use it in GitHub Desktop.
Save GabeStah/4e1e179b21795b46ad1a to your computer and use it in GitHub Desktop.
local UnitIsCasting = function(spell, unit)
unit = unit or 'player'
if not UnitExists(unit) then return end
local spellName, _, _, _, spellStart, spellEnd, _, spellId = UnitCastingInfo(unit)
if not spellName then return end
if spell then
if type(spell) == 'string' then
if spellName == spell then return spellName, spellStart, spellEnd end
elseif type(tonumber(spell)) == 'number' then
if tonumber(spell) == spellId then return spellName, spellStart, spellEnd end
end
else
return spellName, spellStart, spellEnd
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment