How to save/load data to/from file?

A project to port LÖVE to Android handhelds
Locked
User avatar
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

How to save/load data to/from file?

Post by Ratchet »

I want to store game data like highscores or something but i.e the love.filesystem.write won't work. Is this a problem of the path I use?
"/mnt/sdcard/Android/data/com.ratchet.gamename/filename.txt"
macOS 10.14 Mojave | LÖVE 11.2
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: How to save/load data to/from file?

Post by T-Bone »

I just think that love.filesystem simply isn't implemented yet. Just wait for it.

Also, writing to the sdcard is probably not what you want. It requires special permissions if you make your game standalone. It's better to use folders that the Android system gives each app for smaller files like settings, high scores etc.
User avatar
Username
Citizen
Posts: 54
Joined: Mon Jan 28, 2013 1:25 pm

Re: How to save/load data to/from file?

Post by Username »

T-Bone wrote:I just think that love.filesystem simply isn't implemented yet. Just wait for it.

Also, writing to the sdcard is probably not what you want. It requires special permissions if you make your game standalone. It's better to use folders that the Android system gives each app for smaller files like settings, high scores etc.
What if I need to load custom files from the user, for example, custom maps, or custom <insert_here_something>?

With Lua IO procedures I can do this on PC quite easy, but on Android? Can't i just io.open("/mnt/sdcard/something.map", "r")?

I need to test on my device...
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: How to save/load data to/from file?

Post by T-Bone »

Username wrote:
T-Bone wrote:I just think that love.filesystem simply isn't implemented yet. Just wait for it.

Also, writing to the sdcard is probably not what you want. It requires special permissions if you make your game standalone. It's better to use folders that the Android system gives each app for smaller files like settings, high scores etc.
What if I need to load custom files from the user, for example, custom maps, or custom <insert_here_something>?

With Lua IO procedures I can do this on PC quite easy, but on Android? Can't i just io.open("/mnt/sdcard/something.map", "r")?

I need to test on my device...
It could work, just make sure you have permission to read the sdcard.
User avatar
Ratchet
Citizen
Posts: 67
Joined: Mon Apr 08, 2013 10:32 am

Re: How to save/load data to/from file?

Post by Ratchet »

Would be great to see this working in the near future. I guess love is great for making stuff for android but quite useless if you even can't store the player's name :awesome:
macOS 10.14 Mojave | LÖVE 11.2
Locked

Who is online

Users browsing this forum: No registered users and 5 guests