I'm trying to create a function where I can give the name of a buff and the function will return the value of the index for that buff. Here's what I have so far, but it isn't working.
Code:
function GetBuffIndex(thisBuff)
local counter = 1
while (UnitBuff("player", counter)) do
if (string.find(UnitBuff("player", counter), thisBuff)) then
local buffIndex = counter;
end
counter = counter + 1
end
return buffIndex
end
Any suggestions on how to get this working? I've tried a bunch of small changes without luck so far. Maybe someone even has a function out there that does this already....?????