GetAuraTooltipInfo
Skildar opened this issue ยท 1 comments
Describe the bug
On the french version of the game, when calling the function WeakAura.GetAuraTooltipInfo withing the graphic custom text as follows :
local name = GetSpellInfo(269279)
local tooltipText, debuffType, tooltipSize = WeakAuras.GetAuraTooltipInfo("player", name, nil)
I get this error stack :
Message: Interface\AddOns\WeakAuras\WeakAuras.lua:4416: Usage: WeakAurasTooltip:SetUnitAura("unit", [index][, "filter"])
Time: Sat Aug 10 14:22:50 2019
Count: 30590
Stack: Interface\AddOns\WeakAuras\WeakAuras.lua:4416: Usage: WeakAurasTooltip:SetUnitAura("unit", [index][, "filter"])
[C]: in function `SetUnitAura'
Interface\AddOns\WeakAuras\WeakAuras.lua:4416: in function `GetAuraTooltipInfo'
[string "--[[ Error in 'Ashvane Critbuff' ]] return ..."]:6: in function <[string "--[[ Error in 'Ashvane Critbuff' ]] return ..."]:1>
[C]: in function `xpcall'
Interface\AddOns\WeakAuras\RegionTypes\Icon.lua:547: in function `UpdateCustomText'
Interface\AddOns\WeakAuras\WeakAuras.lua:4490: in function <Interface\AddOns\WeakAuras\WeakAuras.lua:4484>
Locals: <none>
One other weird thing is that the function is not working if using spell ID instead of spell Name.
I'm sorry I got confused while reading index. I'm closing this issue.
To anyone reading this searching for an answer while stumbling on the same error :
The WeakAuras.GetAuraTooltipInfo function uses index instead of spellID or spellName. The index is the position of the aura you're looking for, meaning I ended up using this function to get the information from the tooltip :
function()
local display = "amount"
local name = GetSpellInfo(269279)
local index = nil;
-- Loop to get buff index
for i=1,40 do
local buff = UnitBuff("player", i)
if buff == name then
index = i
break
end
end
-- Set info as display text
if name and index then
local inline = select(3, WeakAuras.GetAuraTooltipInfo("player", index, HELPFUL))
display = inline
end
return display
end