Doctorbeefy |
04-08-24 09:54 AM |
Sorting table help
I am trying to sort this table by ID but I can't seem to figure it out, is there anyone out there that can assist me? Thank you in advance.
Here is my code:
Lua Code:
function ess(x) if not ITEMSCRAPESTATS then ITEMSCRAPESTATS = {} end ES:SetHyperlink("item:"..x..":0:0:0:0:0:0:0") for i=1, ES:NumLines() do local text = _G["ESTooltipTextLeft"..i]:GetText() if _G["ESTooltipTextLeft2"]:GetText() then ITEMSCRAPESTATS[x] = ITEMSCRAPESTATS[x] or {} table.insert(ITEMSCRAPESTATS[x], _G["ESTooltipTextLeft"..i]:GetText()) else ITEMSCRAPESTATS[x] = ITEMSCRAPESTATS[x] or {} table.insert(ITEMSCRAPESTATS[x], "No Stats for Item Number") end end if _G["ESTooltipTextLeft2"]:GetText() then print("Scraping Stats for Item Number: "..x) else print("No Stats for Item Number: "..x) end end
This is what ends up in the table:
Lua Code:
ITEMSCRAPESTATS = { [60002] = { "Goldroar Signet", -- [1] "Binds when picked up", -- [2] "Unique-Equipped", -- [3] "Finger", -- [4] "+1 Strength", -- [5] "Item Level 15", -- [6] " ", -- [7] }, [60004] = { "Divining Rod", -- [1] "Binds when picked up", -- [2] "Ranged", -- [3] "9 - 17 Fire Damage", -- [4] "(8.7 damage per second)", -- [5] "Requires Level 6", -- [6] "Item Level 12", -- [7] " ", -- [8] }, [60001] = { "Goldroar Band", -- [1] "Binds when picked up", -- [2] "Unique-Equipped", -- [3] "Finger", -- [4] "+1 Intellect", -- [5] "Item Level 15", -- [6] " ", -- [7] }, [60003] = { "Waterlogged Dirge", -- [1] "Binds when picked up", -- [2] "Two-Hand", -- [3] "17 - 26 Damage", -- [4] "(7.2 damage per second)", -- [5] "+1 Strength", -- [6] "+1 Stamina", -- [7] "Requires Level 6", -- [8] "Item Level 10", -- [9] " ", -- [10] }, [60000] = { "Resilient Poncho", -- [1] "Binds when picked up", -- [2] "Back", -- [3] "20 Armor", -- [4] "+1 Spirit", -- [5] "Requires Level 6", -- [6] "Item Level 26", -- [7] " ", -- [8] }, }
I would like it to sort like this:
Lua Code:
ITEMSCRAPESTATS = { [60000] = { "Resilient Poncho", -- [1] "Binds when picked up", -- [2] "Back", -- [3] "20 Armor", -- [4] "+1 Spirit", -- [5] "Requires Level 6", -- [6] "Item Level 26", -- [7] " ", -- [8] }, [60001] = { "Goldroar Band", -- [1] "Binds when picked up", -- [2] "Unique-Equipped", -- [3] "Finger", -- [4] "+1 Intellect", -- [5] "Item Level 15", -- [6] " ", -- [7] }, [60002] = { "Goldroar Signet", -- [1] "Binds when picked up", -- [2] "Unique-Equipped", -- [3] "Finger", -- [4] "+1 Strength", -- [5] "Item Level 15", -- [6] " ", -- [7] }, [60003] = { "Waterlogged Dirge", -- [1] "Binds when picked up", -- [2] "Two-Hand", -- [3] "17 - 26 Damage", -- [4] "(7.2 damage per second)", -- [5] "+1 Strength", -- [6] "+1 Stamina", -- [7] "Requires Level 6", -- [8] "Item Level 10", -- [9] " ", -- [10] }, [60004] = { "Divining Rod", -- [1] "Binds when picked up", -- [2] "Ranged", -- [3] "9 - 17 Fire Damage", -- [4] "(8.7 damage per second)", -- [5] "Requires Level 6", -- [6] "Item Level 12", -- [7] " ", -- [8] }, }
|