aura_duration
The aura_duration function retrieves the remaining duration of a specified aura on a unit. This function is useful for tracking the time left on buffs or debuffs applied to units.
Parameters
unit(string): The unit identifier (such as "player", "target", "focus", etc.) for which to retrieve the aura duration.aura(string): The name or ID of the aura to check.
Returns
duration(number): The remaining duration of the specified aura on the unit, in seconds.
Example Usage in Lua
Here is an example of how to use the aura_duration function in Lua:
local api = ...
-- Function to print the remaining duration of a specific aura on the player
function PrintAuraDuration(unit, aura)
local duration = api.aura_duration(unit, aura)
print("The remaining duration of the aura '" .. aura .. "' on unit '" .. unit .. "' is: " .. duration .. " seconds")
end
-- Example usage: Print the remaining duration of the "Rejuvenation" aura on the player
PrintAuraDuration("player", "Rejuvenation") -- Spell Name
-- Example usage: Print the remaining duration of a spell by using its ID
PrintAuraDuration("player", 123456) -- Spell ID