Page 1 of 1
How to make save files that can be overwritten
Posted: Wed Sep 18, 2019 9:56 pm
by katlyco
I'm working on a Phoenix Wright type game and I need a saving system. I'm not very familiar with Lua and I'm not an expert programmer. Phoenix Wright is kind of like a visual novel with interaction if I were to put it simply. I fictionally want to bookmark a person's place in the story. There really isn't any "health" to save in most sections of the game. All that need saved is evidence and suspects.
how should i go about creating save data?
Re: How to make save files that can be overwritten
Posted: Wed Sep 18, 2019 11:48 pm
by raidho36
You serialize your data into a string, and dump that string into a file. Loading is the same process in reverse. There are serialization libraries that take Lua tables at the input when saving, and produce Lua tables at the output when loading.
Headline question is about files that one cannot overwrite: you set its attribute as read-only. You can do this by executing appropriate shell command, which varies by OS. You may not have permissions to change file attributes, and even then the attributes can be reverted. If you just want to save separate files - simply give them separate filenames.