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)
Saving Data
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Saving Data
Ok so what you do is write this in love.conf:
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!
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
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
Re: Saving Data
Yes, without a doubt should you use love.filesystem. Much easier to work with.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: Saving Data
Life would be so much simpler with SQLite.
Re: Saving Data
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.
I do wish love.filesystem had easy binary file capability though. Sometimes flat binary output is just better than text.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Saving Data
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.
Re: Saving Data
I stand corrected. I've yet to work with files anyway.
- Lemony Lime
- Prole
- Posts: 22
- Joined: Fri Dec 28, 2012 9:35 pm
Re: Saving Data
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.
- Lemony Lime
- Prole
- Posts: 22
- Joined: Fri Dec 28, 2012 9:35 pm
Re: Saving Data
Fun fact, Lua's file IO will write files to the LOVE install directory.
Re: Saving Data
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 5 guests