Document which calls raise events

Post Reply
User avatar
Therax
Filter Inserter
Filter Inserter
Posts: 470
Joined: Sun May 21, 2017 6:28 pm
Contact:

Document which calls raise events

Post by Therax »

Some but not all API calls can raise events, which may invalidate LuaObjects held by mods. It would be good if the documentation for the API calls indicated whether they raise events, so mod authors can know whether it is necessary to re-validate held references.
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground

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

Re: Document which calls raise events

Post by Rseding91 »

The concept sounds nice but quickly becomes a huge annoyance for us internally as we have to every time we change anything to fire an event or not go over literally all of the Lua API and check which things may get to that logic by any round-about way.

In the end, you should always validate your objects are valid before using them.
If you want to get ahold of me I'm almost always on Discord.

Bilka
Factorio Staff
Factorio Staff
Posts: 3123
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Document which calls raise events

Post by Bilka »

Rseding91 wrote:
Thu Jul 25, 2019 5:38 pm
The concept sounds nice but quickly becomes a huge annoyance for us internally as we have to every time we change anything to fire an event or not go over literally all of the Lua API and check which things may get to that logic by any round-about way.

In the end, you should always validate your objects are valid before using them.
You know that I'm crazy about documentation :p
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Resolved Requests”