[0.14.21] game.get_event_handler doesn't work

This subforum contains all the issues which we already resolved.
User avatar
zx64
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Fri Dec 16, 2016 3:57 pm
Contact:

[0.14.21] game.get_event_handler doesn't work

Post 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)

Rseding91
Factorio Staff
Factorio Staff
Posts: 14126
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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).
If you want to get ahold of me I'm almost always on Discord.

User avatar
zx64
Long Handed Inserter
Long Handed Inserter
Posts: 58
Joined: Fri Dec 16, 2016 3:57 pm
Contact:

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

Post by zx64 »

Thanks, yeah, the example was just the bare minimum to do "something" with the result.

Post Reply

Return to “Resolved Problems and Bugs”