Quantcast

Register the tags outside of the Enable function

p3lim [10-14-10 - 17:52]
Register the tags outside of the Enable function
Filename
oUF_Reputation.lua
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