Page 1 of 1

game.write_file not appending

Posted: Fri Jan 28, 2022 6:20 pm
by mattie112
https://lua-api.factorio.com/latest/Lua ... write_file

Code: Select all

write_file (filename, data, append, for_player) 
So I have this piece of code:

Code: Select all

local function log_message(msg)
    msg = game.tick .. " " .. msg
    game.write_file(baseFolder .. baseFile, "[FactorioChatBot]: " .. serpent.line(msg, { comment = false }, true))
end
And I expect my txt file to grow with 1 line each time this is executed. But: it's not. Only the last line is in the file. Why is the append not working?

Re: game.write_file not appending

Posted: Fri Jan 28, 2022 7:39 pm
by robot256
Your "true" for the append argument is inside the parentheses for serpent.block.

Re: game.write_file not appending

Posted: Fri Jan 28, 2022 7:47 pm
by mattie112
Guess it has been a long day... thanks!