diff --git a/Modules/Text.lua b/Modules/Text.lua
index 6b0f011..0e876b3 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -164,6 +164,7 @@ local defaultLines={
[1] = {
name = "UnitName",
left = [[
+local self = StarTip:GetModule("Text")
local c
if self.UnitIsPlayer("mouseover") then
c = self.RAID_CLASS_COLORS[select(2, self.UnitClass("mouseover"))]
@@ -182,6 +183,7 @@ return self.unitName, c
name = "Target",
left = 'return "Target:"',
right = [[
+local self = StarTip:GetModule("Text")
if self.UnitExists("mouseovertarget") then
local c
if self.UnitIsPlayer("mouseovertarget") then
@@ -203,6 +205,7 @@ end
name = "Guild",
left = 'return "Guild:"',
right = [[
+local self = StarTip:GetModule("Text")
local guild = self.GetGuildInfo("mouseover")
if guild then return "<" .. guild .. ">" else return self.unitGuild end
]],
@@ -213,6 +216,7 @@ if guild then return "<" .. guild .. ">" else return self.unitGuild end
name = "Rank",
left = 'return "Rank:"',
right = [[
+local self = StarTip:GetModule("Text")
return select(2, self.GetGuildInfo("mouseover"))
]],
updating = false,
@@ -222,6 +226,7 @@ return select(2, self.GetGuildInfo("mouseover"))
name = "Realm",
left = 'return "Realm:"',
right = [[
+local self = StarTip:GetModule("Text")
return select(2, self.UnitName("mouseover"))
]],
updating = false,
@@ -231,6 +236,7 @@ return select(2, self.UnitName("mouseover"))
name = "Level",
left = 'return "Level:"',
right = [[
+local self = StarTip:GetModule("Text")
local classifications = StarTip.newDict(
"worldboss", "Boss",
"rareelite", "+ Rare",
@@ -259,6 +265,7 @@ return lvl
name = "Race",
left = 'return "Race:"',
right = [[
+local self = StarTip:GetModule("Text")
local race
if self.UnitIsPlayer("mouseover") then
race = self.UnitRace("mouseover");
@@ -274,6 +281,7 @@ return race
name = "Class",
left = 'return "Class:"',
right = [[
+local self = StarTip:GetModule("Text")
local class = self.UnitClass("mouseover")
if class == self.UnitName("mouseover") then return end
local c = self.UnitIsPlayer("mouseover") and self.RAID_CLASS_COLORS[select(2, self.UnitClass("mouseover"))]
@@ -286,6 +294,7 @@ return class, c
name = "Faction",
left = 'return "Faction:"',
right = [[
+local self = StarTip:GetModule("Text")
return self.UnitFactionGroup("mouseover")
]],
updating = false,
@@ -295,6 +304,7 @@ return self.UnitFactionGroup("mouseover")
name = "Status",
left = 'return "Status:"',
right = [[
+local self = StarTip:GetModule("Text")
if not self.UnitIsConnected("mouseover") then
return "Offline"
elseif self.unitHasAura(self.GetSpellInfo(19752)) then
@@ -303,7 +313,7 @@ elseif self.UnitIsFeignDeath("mouseover") then
return "Feigned Death"
elseif self.UnitIsGhost("mouseover") then
return "Ghost"
-elseif self.UnitIsDead("mouseover") and text.unitHasAura(self.GetSpellInfo(20707)) then
+elseif self.UnitIsDead("mouseover") and self.unitHasAura(self.GetSpellInfo(20707)) then
return "Soulstoned"
elseif self.UnitIsDead("mouseover") then
return "Dead"
@@ -316,6 +326,7 @@ end
name = "Health",
left = 'return "Health:"',
right = [[
+local self = StarTip:GetModule("Text")
local health, maxHealth = self.UnitHealth("mouseover"), self.UnitHealthMax("mouseover")
local value
if maxHealth == 100 then
@@ -331,7 +342,7 @@ return value
[12] = {
name = "Mana",
left = [[
-
+local self = StarTip:GetModule("Text")
local class = select(2, self.UnitClass("mouseover"))
if not self.UnitIsPlayer("mouseover") then
class = "MAGE"
@@ -340,6 +351,7 @@ end
return self.powers[class] or "Mana:"
]],
right = [[
+local self = StarTip:GetModule("Text")
local mana = self.UnitMana("mouseover")
local maxMana = self.UnitManaMax("mouseover")
if maxMana == 100 then
@@ -356,6 +368,7 @@ return value
name = "Location",
left = 'return "Location:"',
right = [[
+local self = StarTip:GetModule("Text")
return self.unitLocation
]],
updating = true,
@@ -614,6 +627,16 @@ function mod:RebuildOpts()
end,
order = 6
},
+ enabled = {
+ name = "Enabled",
+ desc = "Whether to show this line or not",
+ type = "toggle",
+ get = function() return self.db.profile.lilnes[i].enabled end,
+ set = function(info, v)
+ self.db.profile.lines[i].enabled = v
+ end,
+ order = 7
+ },
delete = {
name = "Delete",
desc = "Delete this line",
@@ -624,7 +647,7 @@ function mod:RebuildOpts()
StarTip:RebuildOpts()
self:CreateLines()
end,
- order = 7
+ order = 8
},
},
order = i + 5
diff --git a/StarTip.lua b/StarTip.lua
index 61c1037..f0931cb 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -142,19 +142,20 @@ do
t.__starref__ = true
return t
end
- function StarTip:del(...)
+ function StarTip.del(t, ...)
+ if type(t) ~= "table" or not t.__starref__ then return end
for i=1, select("#", ...) do
local t = select(i, ...)
if (t and type(t) ~= table) or t == nil then break end
for k, v in pairs(t) do
if type(k) == "table" then
- if t.__starref__ then StarTip:del(k) end
- t.__starref__ = nil
+ StarTip:del(k)
end
- t[k] = nil
+ pool[k] = true
end
- pool[t] = true
end
+ t.__starref__ = nil
+ pool[t] = true
end
end
@@ -194,10 +195,18 @@ do
return ""
end
- local table = {self = StarTip:GetModule("Text"), _G = _G, StarTip = StarTip, select = select, format = format}
+
+ local table = StarTip:new()
+ table.self = StarTip:GetModule("Text")
+ table._G = _G
+ table.StarTip = StarTip
+ table.select = select
+ table.format = format
setfenv(runnable, table)
+ StarTip.del(table)
+
return runnable(xpcall, errorhandler)
end
end