Cloud - stingray.Cloud namespace reference - Stingray Lua API Reference

stingray.Cloud namespace reference

Description

The interface to the load and save functionality on the Windows platform.

As the object is a singleton (there is only one Cloud), you do not need to pass any Cloud object to the functions. All the functions operate on the Cloud singleton.

Cloud provides easy and transparent remote file storage for your game. Files are written to disk while the game is running and are replicated to the Steam back-end after the game exits. If the user changes computers, the files are downloaded to the new computer before the game launches.

The namespace for filenames is flat; no directories are used or created. If a folder structure is needed, you can solve this by prefixing filenames. All filenames are case insensitive.

Asynchronous operations return a token object that is used to fetch progress during the operation. This object must be closed to free the information that is used during the load/save operation. Otherwise, the game eventually runs out of memory.

You can save the following data types:

Functions

Parameters

filename :

string

The name of the file to load.

Returns

stingray.CloudToken

A token that you can query by calling progress().

You must call stingray.Cloud.close() on the token returned to release the memory (after you have checked the progress of the operation). Failure to do so results in memory leaks.

Parameters

filename :

string

The name of the file in which to store the data.

data :

any

The data to store.

Returns

stingray.CloudToken

A token that you can query by calling progress().

You must call stingray.Cloud.close() on the token returned to release the memory (after you have checked the progress of the operation). Failure to do so results in memory leaks.

Parameters

token :

stingray.CloudToken

The token that you want to close.

Returns
This function does not return any values.
Parameters

filename :

string

The name of the file to delete.

Returns

stingray.CloudToken

A token that you can query by calling progress().

Use delete() when users explicitly delete files in your application's interface.

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the Steam cloud is enabled for the game.

You can set this up in the 'Game Admin' page on Steamworks.

Note: If Cloud is not enabled, load and save operations will not work.

Parameters

filename :

string

The name of the file to forget.

Returns

stingray.CloudToken

A token that you can query by calling progress().

Use forget() when you want to automatically delete old files in order to free up memory on the cloud service. Do not use forget() when users explicitly delete files.

Parameters

token :

stingray.CloudToken

The cloud token that provides access to the status of the asynchronous operation.

Returns

table

A table that contains information about the save or load operation.