|Attention||Topic was automatically imported from the old Question2Answer platform.|
I followed this tutorial and did everything exactly the same way.
But for some reason a unnecessary line is always added to the save file, so it doesn’t work.
If I delete that line myself, the loading works!
But every time the game saves, this empty line is added and the loading doesn’t work anymore because of that.
Error message: "Invalid get index ‘filename’ (on base: ‘Nil’)
How can I fix this?
The line break at the end of file shouldn’t cause it to become invalid – it works here with a JSON file that has a final LF line break.
Is the file saved using CRLF or LF line endings, and does it work if you convert it to LF then save it? (You can see that in the bottom-right corner of Visual Studio Code; click it to change the line ending type).
Calinou | 2019-02-07 00:28
It doesn’t works neither with CRLF nor with LF.
And my code is exactly as in the tutorial.
Is there maybe a way to automatically delete the last line of a file by code?
Banduck | 2019-02-07 09:23