From 083e0f0f71e13bb5546adb03be1bdeb180106e5f Mon Sep 17 00:00:00 2001 From: ackis Date: Wed, 15 Apr 2009 18:13:29 +0000 Subject: [PATCH] Code optimizations. --- ARLFrame.lua | 16 ++++++++++++++++ AckisRecipeList.lua | 24 ++++++++++++------------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/ARLFrame.lua b/ARLFrame.lua index 1d37dcb..fb1ad0e 100644 --- a/ARLFrame.lua +++ b/ARLFrame.lua @@ -41,12 +41,28 @@ local narrowFont = nil local normalFont = nil local pairs = pairs +local select = select + +local table.wipe = table.wipe +local tremove = table.remove +local tonumber = tonumber + +local math.floor = math.floor + +local strlower = string.lower + local GetSpellInfo = GetSpellInfo local GetSkillLineInfo = GetSkillLineInfo local GetNumSkillLines = GetNumSkillLines local ExpandSkillHeader = ExpandSkillHeader local CollapseSkillHeader = CollapseSkillHeader +local GetTradeSkillLine = GetTradeSkillLine +local GetItemInfo = GetItemInfo +local UnitClass = UnitClass + +-- Modifier functions which we deal with +local IsModifierKeyDown = IsModifierKeyDown local IsShiftKeyDown = IsShiftKeyDown local IsAltKeyDown = IsAltKeyDown local IsControlKeyDown = IsControlKeyDown diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua index 6d66c0c..a73b5dd 100644 --- a/AckisRecipeList.lua +++ b/AckisRecipeList.lua @@ -118,7 +118,7 @@ local string = string local format = format local sfind = string.find local smatch = string.match -local tolower = string.lower +local strlower = string.lower --[[ @@ -1510,23 +1510,23 @@ end function addon:ChatCommand(input) -- Open About panel if there's no parameters or if we do /arl about - if (not input) or (input and input:trim() == "") or (input == tolower(L["Sorting"])) or (input == tolower(L["Sort"])) or (input == tolower(L["Display"])) then + if (not input) or (input and input:trim() == "") or (input == strlower(L["Sorting"])) or (input == strlower(L["Sort"])) or (input == strlower(L["Display"])) then InterfaceOptionsFrame_OpenToCategory(self.optionsFrame) - elseif (input == tolower(L["About"])) then + elseif (input == strlower(L["About"])) then if (self.optionsFrame["About"]) then InterfaceOptionsFrame_OpenToCategory(self.optionsFrame["About"]) else InterfaceOptionsFrame_OpenToCategory(self.optionsFrame) end - elseif (input == tolower(L["Profile"])) then + elseif (input == strlower(L["Profile"])) then InterfaceOptionsFrame_OpenToCategory(self.optionsFrame["Profiles"]) - elseif (input == tolower(L["Filter"])) then + elseif (input == strlower(L["Filter"])) then InterfaceOptionsFrame_OpenToCategory(self.optionsFrame["Filters"]) - elseif (input == tolower(L["Documentation"])) then + elseif (input == strlower(L["Documentation"])) then InterfaceOptionsFrame_OpenToCategory(self.optionsFrame["Documentation"]) - elseif (input == tolower(L["Scan"])) then + elseif (input == strlower(L["Scan"])) then self:AckisRecipeList_Command(false) - elseif (input == tolower("scandata")) then + elseif (input == strlower("scandata")) then self:ScanSkillLevelData() else -- What happens when we get here? @@ -2136,7 +2136,7 @@ function addon:SearchRecipeDB(RecipeDB, searchstring) if (searchstring) then - searchstring = tolower(searchstring) + searchstring = strlower(searchstring) -- Go through the entire database for SpellID in pairs(RecipeDB) do @@ -2148,13 +2148,13 @@ function addon:SearchRecipeDB(RecipeDB, searchstring) recipe["Search"] = false -- Allow us to search by spell ID - if sfind(tolower(SpellID),searchstring) or + if sfind(strlower(SpellID),searchstring) or -- Allow us to search byitem ID - (recipe["ItemID"] and sfind(tolower(recipe["ItemID"]),searchstring)) or + (recipe["ItemID"] and sfind(strlower(recipe["ItemID"]),searchstring)) or -- Allow us to search by name - (recipe["Name"] and sfind(tolower(recipe["Name"]),searchstring)) or + (recipe["Name"] and sfind(strlower(recipe["Name"]),searchstring)) or -- Allow us to search by locations (recipe["Locations"] and sfind(recipe["Locations"],searchstring)) or -- 1.7.9.5