From 28f735a862e8f9708ecda268a4d1c0199df8304f Mon Sep 17 00:00:00 2001 From: p3lim Date: Thu, 14 Oct 2010 19:52:03 +0200 Subject: [PATCH] Register the tags outside of the Enable function --- oUF_Reputation.lua | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/oUF_Reputation.lua b/oUF_Reputation.lua index 2ce5d58..2769170 100644 --- a/oUF_Reputation.lua +++ b/oUF_Reputation.lua @@ -2,25 +2,28 @@ local _, ns = ... local oUF = ns.oUF or oUF assert(oUF, 'oUF Reputation was unable to locate oUF install') -local tagStrings = { - ['currep'] = function(unit) +for tag, func in pairs({ + ['currep'] = function() local _, _, _, _, value = GetWatchedFactionInfo() return value end, - ['maxrep'] = function(unit) + ['maxrep'] = function() local _, _, _, max = GetWatchedFactionInfo() return max end, - ['perrep'] = function(unit) + ['perrep'] = function() local _, _, _, max, value = GetWatchedFactionInfo() return math.floor(value / max * 100 + 0.5) end, - ['standing'] = function(unit) + ['standing'] = function() local _, standing = GetWatchedFactionInfo() return standing end, ['reputation'] = GetWatchedFactionInfo -} +}) do + oUF.Tags[tag] = func + oUF.TagEvents[tag] = 'UPDATE_FACTION' +end local function Update(self, event, unit) local reputation = self.Reputation @@ -56,11 +59,6 @@ local function Enable(self, unit) self:RegisterEvent('UPDATE_FACTION', Path) - for tag, func in pairs(tagStrings) do - oUF.Tags[tag] = func - oUF.TagEvents[tag] = 'UPDATE_FACTION' - end - if(not reputation:GetStatusBarTexture()) then reputation:SetStatusBarTexture([=[Interface\TargetingFrame\UI-StatusBar]=]) end -- 1.7.9.5