Use env. table instead of namespace
Adrian L Lange [02-17-10 - 18:00]
Use env. table instead of namespace
diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua
index 2bd179c..e9e0709 100644
--- a/oUF_P3lim.lua
+++ b/oUF_P3lim.lua
@@ -5,8 +5,7 @@
--]]
-local _, ns = ...
-ns.colors = setmetatable({
+local COLORS = setmetatable({
power = setmetatable({
MANA = {0, 144/255, 1}
}, {__index = oUF.colors.power}),
@@ -17,7 +16,6 @@ ns.colors = setmetatable({
}, {__index = oUF.colors.reaction}),
}, {__index = oUF.colors})
-
local FONT = [=[Interface\AddOns\oUF_P3lim\media\semplice.ttf]=]
local TEXTURE = [=[Interface\AddOns\oUF_P3lim\media\minimalist]=]
local BACKDROP = {
@@ -103,7 +101,7 @@ do
end
local function Style(self, unit)
- self.colors = ns.colors
+ self.colors = COLORS
self:RegisterForClicks('AnyUp')
self:SetScript('OnEnter', UnitFrame_OnEnter)
diff --git a/oUF_P3limTags.lua b/oUF_P3limTags.lua
index 7aeb27e..e88158f 100644
--- a/oUF_P3limTags.lua
+++ b/oUF_P3limTags.lua
@@ -1,5 +1,3 @@
-local _, ns = ...
-
local unpack = unpack
local format = string.format
local gsub = string.gsub
@@ -48,7 +46,7 @@ for name, func in pairs({
end,
['power'] = function(unit)
local _, type = UnitPowerType(unit)
- return ('%s%d|r'):format(Hex(oUF.colors.power[type or 'RUNES']), UnitPower(unit))
+ return ('%s%d|r'):format(Hex(_COLORS.power[type or 'RUNES']), UnitPower(unit))
end,
['druid'] = function(unit)
local min, max = UnitPower(unit, 0), UnitPowerMax(unit, 0)
@@ -63,7 +61,7 @@ for name, func in pairs({
if((UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) or not UnitIsConnected(unit)) then
r, g, b = 3/5, 3/5, 3/5
elseif(not UnitIsPlayer(unit) and reaction) then
- r, g, b = unpack(oUF.colors.reaction[reaction])
+ r, g, b = unpack(_COLORS.reaction[reaction])
elseif(UnitFactionGroup(unit) and UnitIsEnemy(unit, 'player') and UnitIsPVP(unit)) then
r, g, b = 1, 0, 0
end