Page 1 of 1

Event handler

Posted: Mon May 11, 2020 11:37 am
by darkfrei
In the Factorio_0.18\data\core\lualib\ you can find the file event_handler.lua which allows you to run multiple control files without script changing.

How to use it?

I've found some examples in the Factorio_0.18\data\base\scenarios\freeplay\freeplay.lua and Factorio\data\base\scenarios\sandbox\sandbox.lua

How of are you using by modding this feature?

Re: Event handler

Posted: Mon May 11, 2020 11:57 am
by Klonan
I use it in the base game scenarios PvP, Wave defense, and also in my mods,
Such as example: https://github.com/Klonan/Transport_Drones

Basically each lib script returns a few things, such as a table of events, a function for on_init and on_load, etc.
And the event handler script will hook all of them

Re: Event handler

Posted: Mon May 11, 2020 12:32 pm
by darkfrei
Is it the same as event register? viewtopic.php?f=34&t=49186

Re: Event handler

Posted: Mon May 11, 2020 2:22 pm
by Klonan
darkfrei wrote: Mon May 11, 2020 12:32 pm Is it the same as event register? viewtopic.php?f=34&t=49186
I don't know, I have never used that system

Re: Event handler

Posted: Sun May 31, 2020 4:10 pm
by slippycheeze
Klonan wrote: Mon May 11, 2020 2:22 pm
darkfrei wrote: Mon May 11, 2020 12:32 pm Is it the same as event register? viewtopic.php?f=34&t=49186
I don't know, I have never used that system
Same spirit, slightly different implementation, but only vaguely.