Thread: Update 2.5
View Single Post
07/23/16, 08:17 PM   #33
Weolo
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 79
Question GetCharacterInfo() bug?

I just found something a bit odd
When you create a brand new character and log in for the first time, the character does not show up in the GetCharacterInfo() function
It doesn't seem to appear in the functions data until you log out to the character selection screen and back in.

Lua Code:
  1. d("GetCurrentCharacterId: "..GetCurrentCharacterId())
  2. d("GetNumCharacters: "..GetNumCharacters())
  3. for i = 1, GetNumCharacters() do
  4.     local name, gender, level, championRank, classId, raceId, alliance, id, locationId = GetCharacterInfo(i)
  5.     d("id="..tostring(id))
  6. end
  7. local name, gender, level, championRank, classId, raceId, alliance, id, locationId = GetCharacterInfo(GetCurrentCharacterId())
  8. d("id2="..tostring(id))
In the above code example GetCurrentCharacterId() does not appear in the for loop.
And id2 prints out nothing, not even nil
  Reply With Quote