Page 1 of 1

[0.14.21] game.get_event_handler doesn't work

Posted: Mon Jan 16, 2017 11:59 pm
by zx64
My understanding of the documented behaviour is that this snippet should work:

Code: Select all

script.on_event(defines.events.on_tick, function() end);
game.print(tostring(game.get_event_handler(defines.events.on_tick)))
Instead, you get the error "Unknown custom input name: 0" thrown (the 0 comes from value of defines.events.on_tick)

(as an aside, I think this method should be on the LuaBootstrap object instead for symmetry with where you register the event handler - it would be a breaking change but I'm not sure if anything is using it because of the above issue anyway)

Re: [0.14.21] game.get_event_handler doesn't work

Posted: Tue Jan 17, 2017 12:19 am
by Rseding91
Fixed for 0.15 and moved into "script".

Although your example won't work since you're going to be printing the address of a closure (which is what the method returns).

Re: [0.14.21] game.get_event_handler doesn't work

Posted: Tue Jan 17, 2017 12:23 am
by zx64
Thanks, yeah, the example was just the bare minimum to do "something" with the result.