From 90990c813db332b2256e8a0352c5c88481873069 Mon Sep 17 00:00:00 2001 From: Xinhuan Date: Fri, 31 Oct 2008 19:42:15 +0800 Subject: [PATCH] Minor optimization and tweaks. --- Omen.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Omen.lua b/Omen.lua index 5bde560..0f787ba 100644 --- a/Omen.lua +++ b/Omen.lua @@ -54,7 +54,7 @@ LSM:Register("sound", "Omen: Aoogah!", [[Interface\AddOns\Omen\aoogah.ogg]]) ----------------------------------------------------------------------------- -- Localize some global functions local floor, format = floor, format -local tinsert, tremove, sort, wipe = tinsert, tremove, sort, wipe +local tinsert, tremove, next, sort, wipe = tinsert, tremove, next, sort, wipe local UnitDetailedThreatSituation = UnitDetailedThreatSituation local UnitExists, UnitGUID, UnitName, UnitClass = UnitExists, UnitGUID, UnitName, UnitClass local UnitIsPlayer, UnitPlayerControlled, UnitCanAttack = UnitIsPlayer, UnitPlayerControlled, UnitCanAttack @@ -1091,12 +1091,11 @@ function Omen:UpdatePartyGUIDs() end local _ - for k, v in pairs(guidClassLookup) do - guidClassLookup[k] = nil - end - if UnitGUID("player") then - guidNameLookup[UnitGUID("player")] = UnitName("player") - _, guidClassLookup[UnitGUID("player")] = UnitClass("player") + local me = UnitGUID("player") + wipe(guidClassLookup) + if me then -- Because it sometimes is nil on zoning/logging in. + guidNameLookup[me] = UnitName("player") + _, guidClassLookup[me] = UnitClass("player") end if UnitExists("pet") then guidClassLookup[UnitGUID("pet")] = "PET" @@ -1126,9 +1125,9 @@ function Omen:UpdatePartyGUIDs() end end end - guidNameLookup["AGGRO"] = L["> Pull Aggro <"] guidClassLookup["AGGRO"] = "AGGRO" end +guidNameLookup["AGGRO"] = L["> Pull Aggro <"] ----------------------------------------------------------------------------- @@ -1559,7 +1558,7 @@ do Omen_TitleDropDownMenu.displayMode = "MENU" Omen_TitleDropDownMenu.initialize = function(self, level) if not level then return end - for k in pairs(info) do info[k] = nil end + wipe(info) if level == 1 then -- Create the title of the menu info.isTitle = 1 @@ -1593,6 +1592,7 @@ do info.func = function() testMode = not testMode Omen:UpdateBars() + LibStub("AceConfigRegistry-3.0"):NotifyChange("Omen") end info.checked = testMode info.tooltipTitle = L["Test Mode"]