|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Mudley |
|
Old Version |
Published before Godot 3 was released. |
I’m making a logger script for my game, with a function that when is called, opens the log file, inserts the log text, and then closes it.
But I have run into a problem. Each time the new text overwrites the old one, so I would like to know how to append to the file instead.
|
|
|
|
Reply From: |
mollusca |
Open the file with mode READ_WRITE
, seek to the end with seek_end()
, optionally insert a newline with store_string("\n")
and write your log text.
I was so close then! I did exactly that but just in WRITE mode.
Mudley | 2017-05-12 13:22
if your using windows and your file is read in notepad like me, (“\n”) will not work, so you should use (“\r”). That much is what I know, regarding seek_end(), it doesn’t seem to go to the end of my file. It just stays in the beginning. I’ll update this when I got the chance to understand why.