I was using a function in the world of warcraft lua API to make an addon.
My goal was simply to get a list of all tracked achievements the player currently had. The documentation seemed to suggest it should return a list, yet I am getting a number. My code is as follows:
I tracked 6 achievements, 4 of which were in the zone I was testing in.
Addon = LibStub("AceAddon-3.0"):NewAddon("LocationAchievements", "AceConsole-3.0", "AceEvent-3.0")
function Addon:OnInitialize()
Addon:Print(ChatFrame1, "Successfully initialized")
end
function Addon:DisplayAchievements()
Addon:Print(ChatFrame1, UnitName("Player").." has changed to zone "..GetZoneText())
local achievements = GetTrackedAchievements()
Addon:Print(ChatFrame1, "Type of achievements variable: "..type(achievements))
Addon:Print(ChatFrame1, "Number of tracked achievements: "..GetNumTrackedAchievements())
end
Addon:RegisterEvent("ZONE_CHANGED_NEW_AREA", "DisplayAchievements")
When I enter a new area, I receive the following output to my chat box
Crowmonk has changed to zone Shadowmoon Valley
Type of achievement variable: number
Number of tracked achievements: 6
How can this be fixed? What am I doing wrong here?