************
Solved - XML Control had the same name as the addon
***********
I'm fairly new to Lua so perhaps I'm missing something obvious. My IF statement that is checking the addon name keeps failing -- after doing some digging I've found that my TimetoLevel.name is never being set.
Is there a reason that these variables would fail set?
Code:
TimetoLevel = {}
TimetoLevel.name = "TimetoLevel"
function TimetoLevel.Initalize(eventCode, addOnName)
--TimetoLevelCounter:SetText(string.format(TimetoLevel.name)
if ( addOnName ~= TimetoLevel.name ) then
return
end
TimetoLevel.XP = GetUnitXP('player')
TimetoLevel.levelXP = GetNumExperiencePointsInLevel(GetUnitLevel('player'))
TimetoLevel.remainingXP = TimetoLevel.levelXP - TimetoLevel.XP
TimetoLevelCounter:SetText(string.format(addOnName))
EVENT_MANAGER:UnregisterForEvent(TimetoLevel.name, EVENT_ADD_ON_LOADED)
end
EVENT_MANAGER:RegisterForEvent(TimetoLevel.name, EVENT_ADD_ON_LOADED, TimetoLevel.Initalize)
The above code works fine if I do:
Code:
if ( addOnName ~= "TimetoLevel" ) then
return
end
Here is my text file as well
Code:
## Title: TimetoLevel
## Description: Devisaurs Time to Level Version 1.0
## APIVersion: 100019
TimetoLevel.lua
TimetoLevel.xml