Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-19-19, 12:27 PM   #1
fakesaint41
A Murloc Raider
Join Date: Mar 2019
Posts: 7
Can Anyone Explain This Mystery?

I'm stumped... I've worked around it but I'd like to know why it happens. Calling C_PetJournal.GetNumPets() in the handler for the PLAYER_LOGIN or PLAYER_ENTERING_WORLD returns 0... but sticking the call at the beginning of the addon works just fine.


Code:
local numPets = C_PetJournal.GetNumPets()
print("File Start: "..numPets)

function AddonFrame:PlayerLoginHandler()
    local numPets = C_PetJournal.GetNumPets()
    print("Login: "..numPets
end

--   Output in Chat Window on Reload:
-- 
--   File Start: 1002
--   Login: 0


Subsequent calls after login are back to normal. I'm confused why it wouldn't work in the PLAYER_LOGIN handler, despite the API being available before.

I'll give 1 or 2 helpful geniuses here any of the new Raiding With Leashes Pets if you can solve this mystery!!
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Can Anyone Explain This Mystery?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off