love.filesystem.write doesn't work

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
maxtrautwein
Prole
Posts: 17
Joined: Sun Apr 14, 2019 5:14 pm

love.filesystem.write doesn't work

Post 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!
maxtrautwein
Prole
Posts: 17
Joined: Sun Apr 14, 2019 5:14 pm

Re: love.filesystem.write doesn't work

Post 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?
User avatar
pgimeno
Party member
Posts: 3560
Joined: Sun Oct 18, 2015 2:58 pm

Re: love.filesystem.write doesn't work

Post by pgimeno »

Try printing love.filesystem.getSaveDirectory() and see where that is.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: love.filesystem.write doesn't work

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: love.filesystem.write doesn't work

Post 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().
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests