View Single Post
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