How to make save files that can be overwritten

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
katlyco
Prole
Posts: 1
Joined: Wed Sep 18, 2019 9:47 pm

How to make save files that can be overwritten

Post 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?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: How to make save files that can be overwritten

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 5 guests