Make possibility to send a table from data.lua to control.lua

raspberrypuppies
Inserter
Inserter
Posts: 48
Joined: Tue Mar 26, 2019 4:43 am
Contact:

Re: Make possibility to send a table from data.lua to control.lua

Post by raspberrypuppies »

+1, please add this feature.

Some of my mods add new attributes to prototypes like energy usage for entity types that didn't have it before. I wanted to set the energy consumption in the `data` phase so I could have a clean separation between prototype data and `runtime` data. I feel like the `data` phase should have all the magic numbers to make entities work while `runtime` should be focused on the scripting needed to make it come to life. Without an official API bridge between `data` and `runtime` I needed to make a shared file between `data` and `runtime` with my magic constants and references to specific entity types. This also means there's no way for third-party mods to make their own versions of these entity types or tweak their values without me setting up a `runtime` interface for it, but the data itself could serve as an interface and simplify the whole process.

Overall, I think the Factorio modding API is incredible, I just wish this process was a little easier and intuitive.
Thremtopod
Burner Inserter
Burner Inserter
Posts: 13
Joined: Wed Nov 06, 2024 8:52 pm
Contact:

Re: Make possibility to send a table from data.lua to control.lua

Post by Thremtopod »

From the 2.0.58 release notes:
Added the "mod-data" prototype type.
This pretty much fulfills the request, right?
Bilka
Factorio Staff
Factorio Staff
Posts: 3415
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Make possibility to send a table from data.lua to control.lua

Post by Bilka »

Yes, thread moved to implemented.
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 “Implemented mod requests”