mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
optimize widget destruction
This commit is contained in:
@@ -7,9 +7,10 @@ function RadioGroup.create()
|
||||
end
|
||||
|
||||
function RadioGroup:destroy()
|
||||
while #self.widgets ~= 0 do
|
||||
self:removeWidget(self.widgets[1])
|
||||
for k,widget in pairs(self.widgets) do
|
||||
widget.onMousePress = nil
|
||||
end
|
||||
self.widgets = {}
|
||||
end
|
||||
|
||||
function RadioGroup:addWidget(widget)
|
||||
@@ -25,6 +26,13 @@ function RadioGroup:removeWidget(widget)
|
||||
table.removevalue(self.widgets, widget)
|
||||
end
|
||||
|
||||
function RadioGroup:destroy()
|
||||
for k,widget in pairs(self.widgets) do
|
||||
widget.onMousePress = nil
|
||||
end
|
||||
self.widgets = {}
|
||||
end
|
||||
|
||||
function RadioGroup:selectWidget(selectedWidget)
|
||||
if selectedWidget == self.selectedWidget then return end
|
||||
|
||||
|
Reference in New Issue
Block a user