ok so im trying to fix a function for my mod that can determine what spec i am based on the spellid it checks for (eg. spec specific spells, like Lava Lash for Shaman)
However, i've come to a brick wall here :/ This is the current function i am using atm.
Code:
local function CheckForKnownTalent(spellid)
local wanted_name = GetSpellInfo(spellid)
if not wanted_name then return nil end
local num_tabs = GetNumTalentTabs()
for t=1, num_tabs do
local num_talents = GetNumTalents(t)
for i=1, num_talents do
local name_talent, _, _, _, current_rank = GetTalentInfo(t,i)
if name_talent and (name_talent == wanted_name) then
if current_rank and (current_rank > 0) then
return true
else
return false
end
end
end
end
return false
end
EDIT: Oh and this is the call for the function
Code:
local spell1
local spell2
if CheckForKnownTalent(78674) then
spell1 = GetSpellInfo(81192) -- Lunar Shower
elseif CheckForKnownTalent(33878) then
spell2 = GetSpellInfo(33745) -- Lacerate
end
I don't know what i am doing wrong, cause it returns... well, i dont know, cause i dont even get a error