buffDuration

Returns the time remaining on a buff or 0.

buffDuration(spell, [unit]) : integer
-- alts
buffduration(spell, [unit]) : integer
  1. SpellID from the class spellbooks
  2. See Wowpedia for more information on WoW Unit IDs.
  3. Use of object is also supported for unit / unit.

Example

Return the time left on Renew

if buffDuration(Renew, 'player') < 3 and health('player') < 50 then
return cast(Renew, 'player')
end

Note

Spell ID's and Buff ID's for the same spell are not the same. If you find yourself spam caasting something, that is probably the reason.