[0.12.6] [kovarex] on_gui_click handler keeps getting called on error

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

[0.12.6] [kovarex] on_gui_click handler keeps getting called on error

Post by prg »

The on_gui_click event keeps getting fired when the handler causes an error. This isn't something that should happen during normal operation, but it makes debugging a bit harder when I'm trying to figure out how I messed up and the damn terminal is getting spammed with debug output.

Code: Select all

require "defines"

game.on_event(defines.events.on_player_created, function(event)
    game.get_player(event.player_index).gui.left.add{type="button", name="bla", caption="bla"}
end)

num = 0

game.on_event(defines.events.on_gui_click, function(event)
    num = num + 1
    print("on_gui_click called "..tostring(num).." times")
    if num >= 5 then err() end
end)
Click the button five times and the terminal will get spammed with "on_gui_click called x times" till you click the ok button in the error message box. The handler will only be called again if the previous call resulted in an error, if you check for num == 5 in the example, you will only get "on_gui_click called 6 times" as last output, the function won't get called again. This only seems to happen with on_gui_click, not other events.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.6] [kovarex] on_gui_click handler keeps getting called on error

Post by kovarex »

Thank you for the report, it is fixed for 0.12.7 now.

Post Reply

Return to “Resolved Problems and Bugs”