[solved] game.write_file does not work at all

Place to get help with not working mods / modding interface.
Post Reply
User avatar
mpk
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Apr 30, 2018 7:42 am
Contact:

[solved] game.write_file does not work at all

Post by mpk »

hey everyone,
I'm trying to write data with game.write_file(path, data) however it does not work at all, neither in a mod nor when I run it via the ingame console with /c game.write_file('/home/user/text.txt', 'hello there')

when exactly does the game flush the written data? right after the call or does it cache all calls to write_data and waits for the game to close?
I'm on ubuntu, is there anything special I need to be aware of other than sufficient permissions?
Last edited by mpk on Thu May 03, 2018 7:18 am, edited 1 time in total.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2614
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: game.write_file does not work at all

Post by darkfrei »

See Factorio\script-output

keyboardhack
Filter Inserter
Filter Inserter
Posts: 475
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: game.write_file does not work at all

Post by keyboardhack »

mpk wrote:When exactly does the game flush the written data? right after the call or does it cache all calls to write_data and waits for the game to close?
It should write the file immediately. If you are running this in multiplayer, try with the command /c game.write_file("text.txt", "hello there", false, 1)
Waste of bytes : P

User avatar
mpk
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Apr 30, 2018 7:42 am
Contact:

Re: game.write_file does not work at all

Post by mpk »

darkfrei wrote:See Factorio\script-output
Yup there it is, that solves it. Factorio file writes seem to take this directory always as their root :roll:
This should be noted in the api wiki.

Post Reply

Return to “Modding help”

Who is online

Users browsing this forum: No registered users