Expected: Event only fires once.
To recreate:
* Run this command to create a gui element and hook into the event:
Code: Select all
/c global.count = 0; game.player.gui.center.add{type="switch", name="bug"}; script.on_event(defines.events.on_gui_click, function() global.count = global.count +1 game.print(global.count) end)
* Observe results:
1
2
Expected:
1
I suspect this wasn't noticed because most people interacting with this were listening to the toggle event which works fine, but for most use cases this event should work as well.