Removed goto usage

This commit is contained in:
badgamernl
2020-02-26 00:35:55 +01:00
parent 1273de4e86
commit 3aa77227ca

View File

@@ -160,28 +160,20 @@ function Gui.hide_left_flow(player)
local top_flow = Gui.get_top_flow(player) local top_flow = Gui.get_top_flow(player)
-- Check if the the element has a button attached -- Check if the the element has a button attached
if not element_define.toolbar_button then if element_define.toolbar_button then
goto hide_left_flow_end
end
-- Check if the topflow contains the button -- Check if the topflow contains the button
local button = top_flow[element_define.toolbar_button] local button = top_flow[element_define.toolbar_button]
if not button then if button then
goto hide_left_flow_end
end
-- Get the button define from the reverse lookup on the element -- Get the button define from the reverse lookup on the element
local button_define = Gui.defines[element_define.toolbar_button] local button_define = Gui.defines[element_define.toolbar_button]
-- Raise the custom event if all of the top checks have passed -- Raise the custom event if all of the top checks have passed
button_define:raise_custom_event{ button_define:raise_custom_event{
name = Gui.events.on_visibility_changed_by_click, name = Gui.events.on_visibility_changed_by_click,
element = button, element = button,
state = false state = false
} }
end
-- Label for the end of the loop end
::hide_left_flow_end::
end end
end end