Anotther difficulty

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.
User avatar
BrotSagtMist
Party member
Posts: 607
Joined: Fri Aug 06, 2021 10:30 pm

Re: Anotther difficulty

Post by BrotSagtMist »

Mind you all stop with this lib nonsense for task that are trivial and have inbuilds?
Youre all looking for table.concat here.
love.filesystem.write("save", table.concat (score,"\n") )
obey
User avatar
BoonyBuny
Prole
Posts: 31
Joined: Mon Jun 13, 2022 1:24 am
Location: France
Contact:

Re: Anotther difficulty

Post by BoonyBuny »

Code: Select all

function saveScore()
    local serialize = require '/libraries/ser'
    local ScoreData={bestscore, coins}
    love.filesystem.write("data.txt", serialize(ScoreData))
end

function loadScore()
--missing
end
Okay why does saveScore() writes absolutely nothing in data.txt? I'm really confused
A coding begginer that is migrating from 8 years of Scratch... yea yikes. :emo:
User avatar
BoonyBuny
Prole
Posts: 31
Joined: Mon Jun 13, 2022 1:24 am
Location: France
Contact:

Re: Anotther difficulty

Post by BoonyBuny »

BrotSagtMist wrote: Mon Jun 27, 2022 1:41 pm Mind you all stop with this lib nonsense for task that are trivial and have inbuilds?
Youre all looking for table.concat here.
love.filesystem.write("save", table.concat (score,"\n") )

Code: Select all

function saveScore()
    local serialize = require '/libraries/ser'
    local ScoreData={bestscore, coins}
    love.filesystem.write("data.txt", table.concat(ScoreData,"\n"))
end
it still doesn't write anything
A coding begginer that is migrating from 8 years of Scratch... yea yikes. :emo:
User avatar
BrotSagtMist
Party member
Posts: 607
Joined: Fri Aug 06, 2021 10:30 pm

Re: Anotther difficulty

Post by BrotSagtMist »

At this point i just assume youre looking at the wrong location.
my save dir is ~/.local/share/love
So this is os/settings specific. You may just wanna search the file.
obey
User avatar
BoonyBuny
Prole
Posts: 31
Joined: Mon Jun 13, 2022 1:24 am
Location: France
Contact:

Re: Anotther difficulty

Post by BoonyBuny »

is this related to conf.lua and t.indentity?

Mine is just t.identity = "Balloon_adventure"
A coding begginer that is migrating from 8 years of Scratch... yea yikes. :emo:
User avatar
BrotSagtMist
Party member
Posts: 607
Joined: Fri Aug 06, 2021 10:30 pm

Re: Anotther difficulty

Post by BrotSagtMist »

I usually dont set it and it then just copies the name of the folder/file.
But yea, youre looking for that folder.
obey
User avatar
BoonyBuny
Prole
Posts: 31
Joined: Mon Jun 13, 2022 1:24 am
Location: France
Contact:

Re: Anotther difficulty

Post by BoonyBuny »

even with t.identity = love.filesystem.getIdentity() theres still nothing beeing written in the data.txt, i'm really at a loss here
A coding begginer that is migrating from 8 years of Scratch... yea yikes. :emo:
User avatar
BrotSagtMist
Party member
Posts: 607
Joined: Fri Aug 06, 2021 10:30 pm

Re: Anotther difficulty

Post by BrotSagtMist »

t.identity = love.filesystem.getIdentity() <-- What?
Like what is the thought process in that?

Anyway check these paths https://love2d.org/wiki/love.filesystem
There should be a folder folder named after your game in these.
And there is very little chance that the write function failed.

Actually do

Code: Select all

local s, e = love.filesystem.write("data.txt","test" ) 
print(s,e) 
to see if there is an error.
obey
Andlac028
Party member
Posts: 174
Joined: Fri Dec 14, 2018 2:27 pm
Location: Slovakia

Re: Anotther difficulty

Post by Andlac028 »

You can get real path to data.txt by

Code: Select all

love.filesystem.getRealDirectory("data.txt")
User avatar
BrotSagtMist
Party member
Posts: 607
Joined: Fri Aug 06, 2021 10:30 pm

Re: Anotther difficulty

Post by BrotSagtMist »

Duh yea.
But its love.filesystem.getSaveDirectory()
Yours works on folders.
obey
Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests