From e0e55e5760de78af86ed547fd7fb2b3642c05829 Mon Sep 17 00:00:00 2001 From: Ackis Date: Wed, 29 Oct 2008 20:36:08 +0000 Subject: [PATCH] Ackis Recipe List: - Implement a basic sort by location function, this is to get that type of sorting out there and it's on the feature list to implement a tree view for locations. - Will on sort from the first location (same as acquisition sorting based off of the first acquisition method), and locations are first sorted by name - Dry-coded (Compiles with luac -p) --- ARLConfig.lua | 3 +-- AckisRecipeList.lua | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ARLConfig.lua b/ARLConfig.lua index 2f6af71..117153d 100644 --- a/ARLConfig.lua +++ b/ARLConfig.lua @@ -1084,9 +1084,8 @@ local function fullOptions() name = L["Sorting"], desc = L["SORTING_DESC"], get = function() return addon.db.profile.sorting end, - -- This will probably cause people in multiple locals to have issues set = function(info,name) addon.db.profile.sorting = name end, - values = function() return {Name = L["Name"], Skill = L["Skill"], Acquisition = L["Acquisition"]} end, + values = function() return {Name = L["Name"], Skill = L["Skill"], Acquisition = L["Acquisition"], Location = L["Location"]} end, }, }, }, diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua index 0327e30..afffbf7 100644 --- a/AckisRecipeList.lua +++ b/AckisRecipeList.lua @@ -1444,6 +1444,10 @@ do end + -- Sort the list by the name + tsort(locationlist, function(a, b) return a < b end) + + -- Return the list as a string return tconcat(locationlist,",") else @@ -1810,6 +1814,8 @@ do sortFuncs[L["Location"]] = function (a, b) + return (string.match(RecipeDB[a]["Locations"],"(%w+),") < string.match(RecipeDB[b]["Locations"],"(%w+),")) + end end -- 1.7.9.5