From cea6a20ea3a4f1efd7490b9d9095bf0e7b609baa Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Wed, 16 Apr 2014 16:14:34 +0100 Subject: [PATCH 1/3] Fixed Frame:MakeTop() chaining issue Thanks to htaeD for reporting this. --- objects/frame.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/objects/frame.lua b/objects/frame.lua index 4753a86..2be8a95 100644 --- a/objects/frame.lua +++ b/objects/frame.lua @@ -775,17 +775,17 @@ function newobject:MakeTop() if baseparent.type == "frame" then baseparent:MakeTop() end - return + return self end -- check to see if the object is the only child of the base object if numbasechildren == 1 then - return + return self end -- check to see if the object is already at the top if basechildren[numbasechildren] == self then - return + return self end -- make this the top object @@ -1106,4 +1106,4 @@ function newobject:GetAlwaysOnTop() return self.alwaysontop -end \ No newline at end of file +end From 1642d10816cc72eaaaea8b7ba04aec4bfd904355 Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Wed, 16 Apr 2014 16:23:04 +0100 Subject: [PATCH 2/3] Removed variables that were only used once Overoptimisation. --- objects/frame.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/objects/frame.lua b/objects/frame.lua index 2be8a95..359de1e 100644 --- a/objects/frame.lua +++ b/objects/frame.lua @@ -762,15 +762,12 @@ end --]]--------------------------------------------------------- function newobject:MakeTop() - local x, y = love.mouse.getPosition() local key = 0 - local base = loveframes.base local basechildren = base.children local numbasechildren = #basechildren - local parent = self.parent -- check to see if the object's parent is not the base object - if parent ~= base then + if loveframes.parent ~= loveframes.base then local baseparent = self:GetBaseParent() if baseparent.type == "frame" then baseparent:MakeTop() From b564f42a830d86da28f3d6fe3498a3c88c1cd0c3 Mon Sep 17 00:00:00 2001 From: Qais Patankar Date: Sun, 20 Apr 2014 16:26:08 +0100 Subject: [PATCH 3/3] Reduce variable usage in Frame:MakeTop fix --- objects/frame.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/frame.lua b/objects/frame.lua index 359de1e..3322ea7 100644 --- a/objects/frame.lua +++ b/objects/frame.lua @@ -767,7 +767,7 @@ function newobject:MakeTop() local numbasechildren = #basechildren -- check to see if the object's parent is not the base object - if loveframes.parent ~= loveframes.base then + if self.parent ~= loveframes.base then local baseparent = self:GetBaseParent() if baseparent.type == "frame" then baseparent:MakeTop()