Saving Data

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
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Saving Data

Post by Plu »

If you're using Lua's own I/O it might end up somewhere else. I can't really tell you. But probably still not the source folder.

(You could always write a file with a unique name and search your PC for it)
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Saving Data

Post by Eamonn »

Ok so what you do is write this in love.conf:

Code: Select all

function love.conf(t)
    t.screen.width = 800 -- This doesn't matter
    t.screen.height = 600 -- This doesn't matter either
    t.title = "My little help example!!" -- Nor does this!
    t.author = "Eamonn Rea" -- This is semi-important
    t.identity = "Your_game_name" -- This is important
end
Ok, so the 't.identity' part sets the name of your games save folder. So put in your game's name there, save and run your code, go into that directory again and you should see the folder. Any files you write to will be put there automatically(though I believe you can change this, it isn't really necessary at this point).

Any other problems just ask :)

I recommend using love.filesystem. It's better for LÖVE games. I've never used standard Lua I/0, so I can't help you there :( Sorry!
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Saving Data

Post by T-Bone »

Yes, without a doubt should you use love.filesystem. Much easier to work with.
User avatar
MPQC
Citizen
Posts: 65
Joined: Fri Jun 28, 2013 2:45 pm

Re: Saving Data

Post by MPQC »

Life would be so much simpler with SQLite. :awesome:
Bobbias
Prole
Posts: 36
Joined: Sat Jun 29, 2013 1:26 pm

Re: Saving Data

Post by Bobbias »

Quick, embed SQLite into a Love fork!

I do wish love.filesystem had easy binary file capability though. Sometimes flat binary output is just better than text.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Saving Data

Post by bartbes »

It does, it doesn't know a binary mode, it's always in binary mode. If you produce the binary, it saves and loads it.
Bobbias
Prole
Posts: 36
Joined: Sat Jun 29, 2013 1:26 pm

Re: Saving Data

Post by Bobbias »

I stand corrected. I've yet to work with files anyway.
User avatar
Lemony Lime
Prole
Posts: 22
Joined: Fri Dec 28, 2012 9:35 pm

Re: Saving Data

Post by Lemony Lime »

I've got it mostly sorted out, but there's one more big problem. How do you read either a specific byte or specific line of a file? Either way works. If it's not possible, then love just can't do what I'm trying to do. love.filesystem.lines and file:read don't work, because they force you to start at the beginning of the file. I need to be able to pick a line or a byte at will and read it directly.
User avatar
Lemony Lime
Prole
Posts: 22
Joined: Fri Dec 28, 2012 9:35 pm

Re: Saving Data

Post by Lemony Lime »

Fun fact, Lua's file IO will write files to the LOVE install directory.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Saving Data

Post by Boolsheet »

If you give the Lua IO library a relative path, it will be relative to the working directory. On Windows, if you use a shortcut it usually points to working directory to the executable which seems to be the LÖVE program files directory for you.
Shallow indentations.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 0 guests