I’m writing an addon to export all of my characters’ gear info. I’ve had limited success with the use of GetItemInfo(itemLink), where the itemLevel doesn’t always come back correctly. MOST of the time it does, but there are odd instances where it comes back with “1” or “39” or something, on my Level 70 characters that are clearly not wearing low level stuff.
So I tried to switch to a hybrid of GetItemInfo(itemLink) and GetDetailedItemLevelInfo(itemLink). Note that itemLink comes from a call to GetInventoryItemLink(“player”, #).
Now, with that added in, every time I login, I get an LUA error that makes zero sense to me:
Message: Usage: local actualItemLevel, previewLevel, sparseItemLevel = C_Item.GetDetailedItemLevelInfo(itemInfo)
Time: Mon Apr 29 21:00:24 2024
Count: 2
Stack: Usage: local actualItemLevel, previewLevel, sparseItemLevel = C_Item.GetDetailedItemLevelInfo(itemInfo)
[string “=[C]”]: in function `GetDetailedItemLevelInfo’
[string “@Interface/AddOns/CharacterGearExporter/CharacterGearExporter.lua”]:58: in function <…dOns/CharacterGearExporter/CharacterGearExporter.lua:11>Locals: (*temporary) = “Usage: local actualItemLevel, previewLevel, sparseItemLevel = C_Item.GetDetailedItemLevelInfo(itemInfo)”
I’ve no idea what this is trying to tell me. Strangely the data is still saved and written to SavedVariables even with this error.
Some added info: My addon subscribes to PLAYER_LOGIN, PLAYER_LOGOUT, ADDON_LOADED, and PLAYER_EQUIPMENT_CHANGED. Before I attempt to set the SavedVariables information, I wait to be sure that both LOGIN and LOADED has happened. But maybe that’s not enough? Is there some other event? I have a C_Timer, and wait 2 seconds even after those 2 events.
Interestingly, if I set that C_Timer to 30 seconds…I don’t seem to get the error. So it’s seems like a race condition of when item information is actually available after logging in?