Skip to content

Commit f2c0e11

Browse files
committed
added index to buttons
1 parent 58f16ed commit f2c0e11

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

Src/Elements/Button.luau

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ local Element = {}
88
Element.__index = Element
99
Element.__type = "Button"
1010

11-
function Element:New(Config)
11+
function Element:New(Idx, Config)
1212
local Library = self.Library
1313
assert(Config.Title, "Button - Missing Title")
1414
Config.Callback = Config.Callback or function() end
@@ -36,15 +36,10 @@ function Element:New(Config)
3636

3737
function ButtonFrame:Destroy()
3838
ButtonFrame.Frame:Destroy()
39-
40-
for i, v in ipairs(Library.Buttons) do
41-
if v == ButtonFrame then
42-
table.remove(Library.Buttons, i)
43-
end
44-
end
39+
Library.Buttons[Idx] = nil
4540
end
4641

47-
table.insert(Library.Buttons, ButtonFrame)
42+
Library.Buttons[Idx] = ButtonFrame
4843
ButtonFrame.Instance = ButtonFrame
4944

5045
return ButtonFrame

0 commit comments

Comments
 (0)