The interface to access the save and load functionality.
Note that this object is a singleton (there is only one SaveSystem), so you do not need to pass any SaveSystem
object to the functions. All the functions operate on the SaveSystem singleton.
You can save the following data types:
Asynchronous operations return a SaveToken object that is used to fetch progress during the operation.
This object must be closed to free the memory that is used during the save. Otherwise, the game will
eventually run out of memory.
On Windows and iOS, you must set up a root directory in which the save system will read and write files.
You do this in the settings.ini file for your project, in the platform-specific save_dir setting. For example:
win32 = {
// ... other windows settings go here
save_dir = "%APPDATA%\\MyCompany\\MyProjectName\\Saves"
}
iOS = {
// ... other iOS settings go here
save_dir = "%SAVEDATA%/MyProjectName"
}
See the settings.ini file reference for more information.
The interface described here is specific to Windows, Mac OS X, iOS, and Android platforms.
|
Starts a silent load, used when the game knows the file that should be loaded.
|
Parameters filename : | string |
The name of the file that contains the data you want to load. You do not need
to specify a directory. Only a-z, 0-9, and _ characters are allowed in the filename.
|
Returns
The file is silently read.
Note that you must call stingray.SaveSystem.close() on the returned token in order to release the
memory allocated by the operation.
|
auto_save ( filename, data ) : stingray.SaveToken
Starts a silent save, used when the game knows the name of the file to write the data to.
|
Parameters filename : | string |
The name of the file that will contain the saved data. You do not need to specify a directory.
Only a-z, 0-9, and _ characters are allowed in the filename.
The file is silently overwritten if it exists.
|
data : | table |
Generally, this is a table that contains the data that needs to be saved.
|
Returns
Note that you must call stingray.SaveSystem.close() on the returned token in order to release the
memory allocated by the operation.
|
You must call this function to close each token that you get from other functions in
the SaveSystem interface.
|
Parameters Returns | This function does not return any values. |
This frees the memory used by the operation.
|
Indicates whether or not the SaveSystem interface exists on the current platform
and is available for use.
|
Parameters | This function does not accept any parameters. |
Returns boolean |
Returns true if the SaveSystem interface is available for use,
or false otherwise.
|
|
progress ( token ) : save_system_progress
Retrieves information about the progress of the save or load operation.
|
Parameters Returns save_system_progress |
A table that contains information about the progress of the save
or load operation, as well as the data loaded (if any).
|