Event handler

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Event handler

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

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Event handler

Post 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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Event handler

Post by darkfrei »

Is it the same as event register? viewtopic.php?f=34&t=49186

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Event handler

Post 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

slippycheeze
Filter Inserter
Filter Inserter
Posts: 587
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Event handler

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

Post Reply

Return to “Modding discussion”