Page 1 of 1

How to save/load data to/from file?

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

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

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

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

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

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

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

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

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