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 » Mon Apr 08, 2013 10:37 am

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 » Mon Apr 08, 2013 2:29 pm

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 » Tue Apr 09, 2013 8:17 am

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 » Tue Apr 09, 2013 9:11 am

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 » Wed Apr 17, 2013 10:00 am

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 3 guests