Quantcast
WoWInterface - View Single Post - Order by name
Thread: Order by name
View Single Post
09-13-14, 01:46 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,537
I haven't tested this but it is a variant of one that was listed at : http://forums.coronalabs.com/topic/4...e-on-2-values/


Lua Code:
  1. -- Sort Function
  2. local function SortTableByKey(a, b )
  3.   if (a.key < b.key) then
  4.     return true
  5.   elseif (a.key > b.key) then
  6.     return false
  7.   end
  8. end
  9.  
  10. -- Build table that can be sorted
  11. local accountant_sorted_data = {}
  12. for key,value in pairs(Accountant_Data) do
  13.   table.insert(accountant_sorted_data = { "Key" = key, "Value" = value })
  14. end
  15.  
  16. -- Sort Table
  17. table.sort( accountant_sorted_data, SortTableByKey)
__________________
  Reply With Quote