From 84d276c37a51d57598f26d7abbbd468636cc394b Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Sun, 21 Mar 2010 03:10:56 -0400 Subject: [PATCH] Renamed sortFuncs to RECIPE_SORT_FUNCS, removed "Location" from it, and updated SortRecipeList() to check for a nil sort function. --- Frame.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Frame.lua b/Frame.lua index 7f52dd4..1cc38a2 100644 --- a/Frame.lua +++ b/Frame.lua @@ -413,6 +413,7 @@ do -- end end + local RECIPE_SORT_FUNCS = { local function Sort_Location(a, b) -- We do the or "" because of nil's, I think this would be better if I just left it as a table which was returned local reca = recipe_list[a].locations or "" @@ -428,23 +429,26 @@ do end end - local sortFuncs = { ["SkillAsc"] = Sort_SkillAsc, ["SkillDesc"] = Sort_SkillDesc, ["Name"] = Sort_Name, ["Acquisition"] = Sort_Acquisition, - ["Location"] = Sort_Location, } - -- Sorts the recipe list according to configuration settings. + -- Sorts the recipe_list according to configuration settings. function SortRecipeList() + local sort_func = RECIPE_SORT_FUNCS[addon.db.profile.sorting] + + if not sort_func then + return + end local sorted_recipes = addon.sorted_recipes twipe(sorted_recipes) for n, v in pairs(private.recipe_list) do tinsert(sorted_recipes, n) end - table.sort(sorted_recipes, sortFuncs[addon.db.profile.sorting]) + table.sort(sorted_recipes, sort_func) end end -- do -- 1.7.9.5