Page 1 of 1

love.filesystem.write doesn't work

Posted: Thu Apr 09, 2020 5:56 am
by maxtrautwein
Hi ! I am trying to save some data on my game but love.filesystem.write doesn't seem to work at all...

I am doing this

Code: Select all

love.filesystem.write('save','anything here')
First I can't even see the LOVE folder in /Application support/ (and I already set an identity in conf.lua)

So I don't understand how I am supposed to write a file and load it?

when I try to load it

Code: Select all

chunk = love.filesystem.load('save.lua')
	 local s = chunk()
	 print(tostring(s))
it says

Code: Select all

Syntax error: save.lua:1: '=' expected near 'here'
But where is my save.lua file if the LOVE folder doesn't exist??

There is something I am missing with this.. if anyone could explain to me I would really appreciate :)

Thanks!

Re: love.filesystem.write doesn't work

Posted: Thu Apr 09, 2020 6:45 am
by maxtrautwein
Ok I managed somehow to make the saving feature works but I still can't see the file in Application Support. I don't know if it's an issue?

Re: love.filesystem.write doesn't work

Posted: Thu Apr 09, 2020 2:02 pm
by pgimeno
Try printing love.filesystem.getSaveDirectory() and see where that is.

Re: love.filesystem.write doesn't work

Posted: Fri Apr 10, 2020 7:33 am
by zorg
You also need to set the identity of your project, so the LOVE/<identity> folder gets created, and your files should be saved there.

Also, you didn't show your save.lua file's contents, so that error message can't really be debugged like this.

Re: love.filesystem.write doesn't work

Posted: Sat Apr 18, 2020 12:06 pm
by AuahDark
LOVE for iOS doesn't expose the save directory to users. You can check whetever the writing successful is by checking the return value of love.filesystem.write().