Access to file manipulation in data stage

L0laapk3
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sun Mar 18, 2018 10:01 pm
Contact:

Access to file manipulation in data stage

Post 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`.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Access to file manipulation in data stage

Post by darkfrei »

+1, it's nice to make locale output or another lib generation for mod creating optimization.
Bilka
Factorio Staff
Factorio Staff
Posts: 3634
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Access to file manipulation in data stage

Post by Bilka »

This was added as LuaHelpers::write_file.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
protocol_1903
Filter Inserter
Filter Inserter
Posts: 325
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: Access to file manipulation in data stage

Post by protocol_1903 »

They specified data stage, not control stage. +1
If you need to reach me, message me on discord.

I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 594
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Access to file manipulation in data stage

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

Return to “Implemented mod requests”