Hi all
I am building a small addon that converts an itemID into an extended itemDetails table.
I have a function that loops through a list of itemID's and gets the full item details which I then insert as a table into another table.
When I check the results in the saved variables file I get a list with only the hearthstone details, all the other entries display only the itemID.
My convert function, (links to my full code are at the bottom of this post)
Lua Code:
-- convert function
local function convertList()
print('convert start')
for k, v inpairs(AAA_FROM_LIST)do
local itemName,
itemLink,
itemRarity,
itemLevel,
itemMinLevel,
itemType,
itemSubType,
itemStackCount,
itemEquipLoc,
iconFileDataID,
itemSellPrice,
itemClassID,
itemSubClassID,
bindType,
expacID,
itemSetID,
isCraftingReagent = GetItemInfo(v)
tempItemList = {
itemID = v,
itemName = itemName,
itemLink = itemLink,
itemRarity = itemRarity,
itemLevel = itemLevel,
itemMinLevel = itemMinLevel,
itemType = itemType,
itemSubType = itemSubType,
itemStackCount = itemStackCount,
itemEquipLoc = itemEquipLoc,
iconFileDataID = iconFileDataID,
itemSellPrice = itemSellPrice,
itemClassID = itemClassID,
itemSubClassID = itemSubClassID,
bindType = bindType,
expacID = expacID,
itemSetID = itemSetID,
isCraftingReagent = isCraftingReagent
}
table.insert(AAA_CONVERTED_LIST,1, tempItemList)
end
print('convert end')
end
My results
Lua Code:
AAA_CONVERTED_LIST = {
{
["itemID"] = 52025,
}, -- [1]
{
["itemID"] = 50717,
}, -- [2]
{
["itemID"] = 50606,
}, -- [3]
{
["itemID"] = 50688,
}, -- [4]
{
["itemID"] = 50639,
}, -- [5]
{
["itemID"] = 50687,
}, -- [6]
{
["itemID"] = 50703,
}, -- [7]
{
["itemID"] = 50650,
}, -- [8]
{
["itemID"] = 52028,
}, -- [9]
{
["itemID"] = 52029,
}, -- [10]
{
["itemID"] = 52026,
}, -- [11]
{
["itemID"] = 50685,
}, -- [12]
{
["itemID"] = 50730,
}, -- [13]
{
["itemID"] = 147561,
}, -- [14]
{
["itemID"] = 114131,
}, -- [15]
{
["itemID"] = 114081,
}, -- [16]
{
["itemID"] = 119229,
}, -- [17]
{
["itemID"] = 119226,
}, -- [18]
{
["itemID"] = 139802,
}, -- [19]
{
["itemID"] = 32240,
}, -- [20]
{
["itemID"] = 32258,
}, -- [21]
{
["itemID"] = 32254,
}, -- [22]
{
["itemID"] = 805,
}, -- [23]
{
["itemID"] = 9763,
}, -- [24]
{
["itemID"] = 4496,
}, -- [25]
{
["itemID"] = 109119,
}, -- [26]
{
["itemID"] = 109253,
}, -- [27]
{
["itemID"] = 128650,
}, -- [28]
{
["itemName"] = "Hearthstone",
["iconFileDataID"] = 134414,
["bindType"] = 1,
["itemSellPrice"] = 0,
["itemLink"] = "|cffffffff|Hitem:6948::::::::19:265::::::|h[Hearthstone]|h|r",
["itemClassID"] = 15,
["itemLevel"] = 1,
["itemStackCount"] = 1,
["isCraftingReagent"] = false,
["expacID"] = 0,
["itemRarity"] = 1,
["itemMinLevel"] = 0,
["itemID"] = 6948,
["itemSubClassID"] = 0,
["itemEquipLoc"] = "",
["itemSubType"] = "Junk",
["itemType"] = "Miscellaneous",
}, -- [29]
{
["itemID"] = 15017,
}, -- [30]
{
["itemID"] = 6268,
}, -- [31]
{
["itemID"] = 90555,
}, -- [32]
{
["itemID"] = 109118,
}, -- [33]
{
["itemID"] = 828,
}, -- [34]
{
["itemID"] = 2657,
}, -- [35]
}
Here is my lua
Here is my toc
Here is my saved variables results
Any help solving this would be great.