Filesystem Loading and Writing Questions

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
LudvickToba
Prole
Posts: 16
Joined: Wed Jan 11, 2017 9:51 pm

Filesystem Loading and Writing Questions

Post by LudvickToba »

I'm working on writing to a file and loading it to act as a save feature. It works but I have a few of questions.

What's the difference between using love.filesystem.write() and using a File object to write (File:write())?

When I use either of these functions it does work when I read the file in LOVE, but when I open up the file in File Explorer (in the .love folder) it's still the same with none of the newly written data in it. Why does it do that?</t>
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Filesystem Loading and Writing Questions

Post by grump »

LudvickToba wrote: Wed May 29, 2019 3:41 am What's the difference between using love.filesystem.write() and using a File object to write (File:write())?
A File object gives you random access to the data, allowing you to seek and read/write arbitrary sized blocks of data at random positions, or to append at the end of the file. You can pass the File object around if required. If you want to save or load large files that don't fit into memory at once, File is your friend.

love.filesystem.write can only write a whole file at once and always replaces existing files with the same name. It is useful to write monolithic blocks of data from memory to disk.
When I use either of these functions it does work when I read the file in LOVE, but when I open up the file in File Explorer (in the .love folder) it's still the same with none of the newly written data in it.
Files are always created in the save folder. The documentation explains this right at the top.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests