Save Engine v1.0.0
This save engine is based on "Roblox Save Engine"
createDataStore(name,jsonObj)
Creates a datastore by that name on that JSON object
saveData(DataId, dataStore, jsonObj, value)
Creates a data save ID on that Datastore and assigns a value on it
readData(DataId, dataStore, jsonObj)
Reads that ID and returns a status which has the value of the requested ID
readSave(file)
Reads that saved file and returns a code which has the jsonObj of the file.
NOTE: The "file" property is the whole file location excluding the extension, Example: "C:/Users/user/Desktop/projects/test/save" instead of "C:/Users/user/Desktop/projects/test/save.json"
writeSave(file, jsonObj)
Writes the file with that JSON Object
NOTE: The "file" property is the whole file location excluding the extension, Example: "C:/Users/user/Desktop/projects/test/save" instead of "C:/Users/user/Desktop/projects/test/save.json"
Status Codes
Success Codes:
Code 0
Used at:
createDataStore
Body:
{code: 0, details: "Datastore created"}
Description:
Datastore Created, This means there is a new Datastore on that JSON object
Code 1
Used at:
SaveData
Body:
{code: 1, details: `Data saved on ${DataId} inside the ${dataStore}
Description:
Data has been saved on that ID inside the datastore successfully
Code 2
Used at:
readData
Body:
{code: 2, details: "Value returned successfully", value: DataStore[DataId]}
Description:
Program could access and read the value of the requested ID, data is stored at "value" property
Code 3
Used at:
readSave
Body:
{code: 3, details: "File read successfully", data: require(`${file}.json`)}
Description:
File has been read and got its JSON object
Code 4
Used at:
writeSave
Body:
{code: 4, details: "File saved sucessfully"}
Description:
File has been saved!
Error Codes:
Code -1
Used at:
createDataStore
Body:
{code: -1, details: `Datastore could not be created due an error: ${err}`}
Description:
Program cannot create a Datastore, explained by "err"
Code -2
Used at:
createDataStore
Body:
{code: -2, details: "Datastore could not be created beacuse there was a datastore with that name."}
Description:
Cannot create another datastore with that name.
Code -3
Used at:
saveData
readData
Body:
{code: -3, details: `Could not access that ID due an error: ${err}`}
Description:
Cannot access that ID due an error explained by "err"
Code -4
Used at:
saveData
readData
Body:
{code: -4, details: "Could not access that Datastore."}
Description:
Cannot access that Datastore do an error, The most common error is Misspelling datastore name
Code -5
Used at:
readData
Body:
{code: -5, details: `Could not find an ID by that name on that Datastore.`}
Description:
Program could not find an ID by that name on the Datastore, check if the ID or the Datastore name are spelled correctly
Code -6
Used at:
readSave
Body:
{code: -6, details: `Error reading the save file: ${err}`}
Description:
Could not read the file, Explained by "err"
Code -7
Used at:
writeSave
Body:
{code: -7, details: `Could not write in the savefile due an error: ${err}`};
Description:
Could not write in the file, Explained by "err"