1
0
Fork 0
This repository has been archived on 2024-05-12. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
GMTK-2023-Postjam/Scripts/Globals/data_store.gd

24 lines
542 B
GDScript

extends Node
var save_config : ConfigFile
## Initial load and parse
func _ready():
save_config = ConfigFile.new()
var err = save_config.load("user://save")
if err:
return
## Read a value with the given string key
func read(key : String, default : Variant):
return save_config.get_value("save", key, default)
## Write a key
func write(key : String, value : Variant):
save_config.set_value("save",key,value)
save_config.save("user://save")
## Reset the savefile
func reset():
save_config.clear()
save_config.save("user://save")