diff --git a/Modules/Text.lua b/Modules/Text.lua
index 3b11d5a..f1a9e03 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -106,7 +106,7 @@ local function updateLines()
if v.updating and v.right and self.db.profile[v.db] then
local left = StarTip.ExecuteCode(mod, v.name, v.left)
local right, c = StarTip.ExecuteCode(mod, v.name, v.right)
- StarTip:del(c)
+ StarTip.del(c)
if left and right then
for i = 1, self.NUM_LINES do
if mod.leftLines[i]:GetText() == left then
@@ -150,7 +150,7 @@ local c
if self.UnitIsPlayer("mouseover") then
c = self.RAID_CLASS_COLORS[select(2, self.UnitClass("mouseover"))]
else
- c = StarTip.new()
+ c = self:new()
c.r, c.g, c.b = self.UnitSelectionColor("mouseover")
end
return self.unitName, c
@@ -169,13 +169,13 @@ if self.UnitExists("mouseovertarget") then
if self.UnitIsPlayer("mouseovertarget") then
c = self.RAID_CLASS_COLORS[select(2, self.UnitClass("mouseovertarget"))]
else
- c = StarTip.new()
+ c = self:new()
c.r, c.g, c.b = self.UnitSelectionColor("mouseovertarget")
end
local name = self.UnitName("mouseovertarget")
return name, c
else
- return "None", StarTip.newDict("r", 1, "g", 1, "b", 1)
+ return "None", self:newDict("r", 1, "g", 1, "b", 1)
end
]],
updating = true,
@@ -213,7 +213,7 @@ return select(2, self.UnitName("mouseover"))
name = "Level",
left = 'return "Level:"',
right = [[
-local classifications = StarTip.newDict(
+local classifications = self:newDict(
"worldboss", "Boss",
"rareelite", "+ Rare",
"elite", "+",
@@ -230,7 +230,7 @@ if classifications[class] then
lvl = lvl .. classifications[class]
end
-StarTip:del(classifications)
+self.del(classifications)
return lvl
]],
@@ -345,7 +345,7 @@ return self.unitLocation
},
[14] = {
name = "Marquee",
- left = 'return "StarTip " .. StarTip.version',
+ left = 'return "StarTip " .. self._G.StarTip.version',
updating = true,
enabled = false,
marquee = true,
@@ -395,6 +395,10 @@ function mod:OnInitialize()
self.db.profile.empty = false
end]]
+ self.new = StarTip.new
+ self.newDict = StarTip.newDict
+ self.del = StarTip.del
+
self.leftLines = StarTip.leftLines
self.rightLines = StarTip.rightLines
self:RegisterEvent("UPDATE_FACTION")
@@ -485,9 +489,8 @@ function mod:CreateLines()
StarTip.del(cc)
end
local tmp = v.marquee
-
- if v.marquee and false then
- local tmp = mod.leftLines[lineNum]
+ if v.marquee then
+ local tmp = mod.leftLines[lineNum]:GetText()
GameTooltip:AddLine(' ', 1, 1, 1)
lineNum = lineNum + 1
v.string = v.left
@@ -497,10 +500,10 @@ function mod:CreateLines()
end
v.marqueeObj = LibMarquee:New(mod.leftLines[lineNum], mod, v, StarTip.db.profile.errorLevel)
v.marqueeObj:Start()
- mod.leftLines[lineNum] = tmp
+ v.lastLine = lineNum
+ mod.leftLines[lineNum]:SetText(tmp)
end
-
end
self.NUM_LINES = lineNum
diff --git a/StarTip.lua b/StarTip.lua
index 015d859..52f28ae 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -4,6 +4,7 @@ local LibDBIcon = LibStub("LibDBIcon-1.0")
local LSM = _G.LibStub("LibSharedMedia-3.0")
local LDB = LibStub:GetLibrary("LibDataBroker-1.1")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
+
local _G = _G
local GameTooltip = _G.GameTooltip
local ipairs, pairs = _G.ipairs, _G.pairs
@@ -174,16 +175,11 @@ local options = {
}
}
+local new, newDict, del
do
local pool = setmetatable({},{__mode='k'})
- local tst = {}
- function StarTip.new(...)
+ function StarTip.new(self, ...)
local t = next(pool)
- if select(1, ...) == StarTip then
- StarTip:Print("Warning: Passing self parameter to new.")
- if not t then t = {} end
- return t
- end
if t then
pool[t] = nil
for i=1, select("#", ...) do
@@ -193,13 +189,11 @@ do
t = {...}
end
t.__starref__ = true
+
return t
end
function StarTip.newDict(...)
local test
- if select(1, ...) == StarTip then
- test = true
- end
local t = next(pool)
if t then
pool[t] = nil
@@ -215,10 +209,6 @@ do
function StarTip.del(...)
local t = select(1, ...)
local test
- if t == StarTip then
- test = true
- t = select(2, ...)
- end
if type(t) ~= "table" or not t.__starref__ then return end
for i=(test and 2 or 1), select("#", ...) do
local t = select(i, ...)
@@ -230,6 +220,10 @@ do
pool[k] = true
end
end
+ local count = 0
+ for k, v in pairs(t) do
+ t[k] = nil
+ end
t.__starref__ = nil
pool[t] = true
end
@@ -272,7 +266,6 @@ function StarTip:OnInitialize()
GameTooltip:Show()
GameTooltip:Hide()
-
end
function StarTip:OnEnable()
diff --git a/embeds.xml b/embeds.xml
index 89c8023..4eef928 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -19,11 +19,11 @@
<Script file = "Libs\LibDatabroker-1.1\LibDatabroker-1.1.lua"/>
<Script file = "Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua"/>
<Script file = "Libs\LibQtip-1.0\LibQtip-1.0.lua"/>
-<Script file = "Libs\StarLibError-1.0\StarLibError-1.0.lua"/>
-<Script file = "Libs\StarLibEvaluator-1.0\StarLibEvaluator-1.0.lua"/>
-<Script file = "Libs\StarLibProperty-1.0\StarLibProperty-1.0.lua"/>
-<Script file = "Libs\StarLibTimer-1.0\StarLibTimer-1.0.lua"/>
-<Script file = "Libs\StarLibMarquee-1.0\StarLibMarquee-1.0.lua"/>
-<Script file = "Libs\StarLibLCD-1.0\StarLibLCD-1.0.lua"/>
+<Script file = "Libs\StarLibs-1.0\StarLibError-1.0\StarLibError-1.0.lua"/>
+<Script file = "Libs\StarLibs-1.0\StarLibEvaluator-1.0\StarLibEvaluator-1.0.lua"/>
+<Script file = "Libs\StarLibs-1.0\StarLibProperty-1.0\StarLibProperty-1.0.lua"/>
+<Script file = "Libs\StarLibs-1.0\StarLibTimer-1.0\StarLibTimer-1.0.lua"/>
+<Script file = "Libs\StarLibs-1.0\StarLibMarquee-1.0\StarLibMarquee-1.0.lua"/>
+<Script file = "Libs\StarLibs-1.0\StarLibLCD-1.0\StarLibLCD-1.0.lua"/>
</Ui>