Page 2 of 2

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

Posted: Sat Jun 21, 2025 7:27 pm
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.

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

Posted: Thu Jun 26, 2025 4:03 pm
by Thremtopod
From the 2.0.58 release notes:
Added the "mod-data" prototype type.
This pretty much fulfills the request, right?

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

Posted: Thu Jun 26, 2025 4:13 pm
by Bilka
Yes, thread moved to implemented.