View Single Post
07-07-22, 12:43 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,894
Tables with string keys are unordered but you can use pairs to return the key/values in whatever order they're found in.

ipairs is for a numerically orderd tables, the same as
Lua Code:
  1. for i=1, #table do
  2.    -- return i, table[i] -- figurative return
  3. end

Lua Code:
  1. for key, value in pairs(stringKeyedTable) do
  2.     print(key, value)
  3. end
  4.  
  5. for key, value in ipairs(numericKeyedTable) do
  6.     print(key, value)
  7. end
In your table, ItemTable, contains a list of sub-tables in numeric order. The sort, resorted them based on the ItemName key each sub-table has.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-07-22 at 08:49 PM.
  Reply With Quote