freettrpg/scripts/save.gd
2024-06-18 19:17:42 +02:00

12 lines
322 B
GDScript

extends Node
func saveJSON(savePath, saveData):
var jsonString = JSON.stringify(saveData)
var fileAccess = FileAccess.open(savePath, FileAccess.WRITE)
if not fileAccess:
print("An error happened while saving data: ", FileAccess.get_open_error())
return 1
fileAccess.store_line(jsonString)
fileAccess.close()