Page 1 of 1

Access to file manipulation in data stage

Posted: Tue Feb 12, 2019 10:28 am
by L0laapk3
I would like to be able to use functions like `write_file` in the data stage.

My use case: I would like to store the actual image url of some icons/signals for later external use (labels on factoriomaps).
Currently, since its not possible to access those after the data stage (that I know of), my options are:
- output everything in a log file, which is not ideal as I'm launching multiple instances of factorio in parallel and would also like to support steam versions of the game which does not allow me access to the console output of factorio.
- dump everything in a big string somehow and read it back later and there use `write_file`.

Re: Access to file manipulation in data stage

Posted: Tue Feb 12, 2019 11:02 am
by darkfrei
+1, it's nice to make locale output or another lib generation for mod creating optimization.

Re: Access to file manipulation in data stage

Posted: Sat Sep 20, 2025 3:31 pm
by Bilka
This was added as LuaHelpers::write_file.

Re: Access to file manipulation in data stage

Posted: Sat Sep 20, 2025 9:50 pm
by protocol_1903
They specified data stage, not control stage. +1

Re: Access to file manipulation in data stage

Posted: Sat Sep 20, 2025 11:02 pm
by Silari
protocol_1903 wrote: Sat Sep 20, 2025 9:50 pm They specified data stage, not control stage. +1
The description says it's used in ALL stages - settings, prototypes (data), and runtime (control). The description of the for_player parameter explicitly lists the other stages.