I'm looping through a SavedVariable storing loot history. Printing line by line with a link to the item within the line. However, when create a SavedVariable with a 100 item history, when I load the game it will do one of them and then error out saying that the variable is nil, expecting value. But it's only once. So basically every time I reload the UI, it'll add one more item successfully to the list until I have the entire list printed out. Then it will no longer error out. Almost as if GetItemInfo is not able to keep up with the loop.
Lua Code:
for i=1, #DKP_Log do
local itemToLink = select(2,GetItemInfo(DKP_Log[i]["loot"])) -- log holds Item ID
.... write variable to fontstring ....
end
error received: Interface\AddOns\DKP\ConfigMenuTabs.lua:546: attempt to concatenate local 'itemToLink' (a nil value)
Just seems really strange that once all items have been loaded, it's fine until the game is restarted. Is there a way to delay the loop on each iteration?