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

stingray.Tus namespace reference

Description

The interface to access the title user storage (TUS) functionality on PlayStation 4.

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

Asynchronous operations return an ID that you can pass in calls to status() to fetch progress during the operation. You must free the memory that is used for this object by calling free() when the operation is done. Otherwise, the game will eventually run out of memory.

Functions

Parameters

target :

any

The target whose slots you want to delete.

options :

integer[]

The slots to delete.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.
Returns

integer

An ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

For example:

stingray.Tus.delete(target, slot_1, slot_2, ...)
Parameters

target :

any

The target whose data slots you want to delete.

options :

integer[]

The slots to delete.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.
Returns

integer

An ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

For example:

stingray.Tus.delete_data(target, slot_1, slot_2, ...)
Parameters

id :

integer

The ID of the operation whose memory you want to free.

Returns
This function does not return any values.

You must call free() on all ids that you get back, whether or not the operation completed successfully. Otherwise, the TUS system will eventually run out of memory.

Parameters

target :

any

The target whose values you want to retrieve.

options :

integer*

The slots from which to get the stored values.

The * notation indicates that there may be zero or more instances of the specified type.
Returns

integer

Returns an ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

When the operation has completed, you can use stingray.Tus.has_get_result() and stingray.Tus.get_result() to get the result of the operation. For example:

stingray.Tus.get(target, slot_1, slot_2, ...)
Parameters

target :

any

The target for the operation.

slot :

integer

The slot whose data you want to retrieve.

Returns

integer

An ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

Parameters

id :

integer

The ID of the stingray.Tus.get_data() operation.

Returns

ps4_tus_slot_data

A table that contains the data retrieved for a specified slot.

Call this only when stingray.Tus.has_get_data_result() returns true.

Parameters

target :

any

The target for the operation.

options :

integer[]

The slots for which the information has to be fetched.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.
Returns

integer

An ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

For example:

stingray.Tus.get_info(target, slot_1, slot_2, ....)
Parameters

id :

integer

The ID of the stingray.Tus.get_info() operation.

Returns

ps4_tus_slot_data

A table with an entry for each slot requested in the stingray.Tus.get_info() call. Each entry has the same fields as in the ps4_tus_slot_data table returned by stingray.Tus.get_data_result(), but without the data field.

Call this only when stingray.Tus.has_get_info_result() returns true.

Parameters

id :

integer

The ID of the stingray.Tus.get() operation.

format :

integer

If you specify the Tus.DETAILS format, this function returns a list of tables, each of which provides the results for a given slot.

Returns

ps4_tus_slot_data[]

A list of tables with an entry for each slot.

The [] notation indicates that this type is an array: a table in which the keys of the members are sequential integers, and the value of each element is an instance of the type shown.

Call this only when stingray.Tus.has_get_result() returns true.

Parameters

id :

integer

The ID of the stingray.Tus.get() operation.

format :

integer

If you specify the Tus.JUST_VALUES format, this function returns the values of the slots directly on the Lua stack.

Returns

number*

Returns values of the slots directly on the Lua stack. If a slot does not have a value, nil is returned for that slot.

The * notation indicates that there may be zero or more instances of the specified type.

Call this only when stingray.Tus.has_get_result() returns true.

Parameters

id :

integer

The ID of the stingray.Tus.get_data() operation.

Returns

boolean

Returns true if there is a usable result for the stingray.Tus.get_data() operation with the specified ID.

You can retrieve the result by calling stingray.Tus.get_data_result().

Parameters

id :

integer

The ID of the stingray.Tus.get_info() operation.

Returns

boolean

Returns true if there is a usable result for the stingray.Tus.get_info() operation with the specified ID.

Parameters

id :

integer

The ID of the stingray.Tus.get() operation.

Returns

boolean

Returns true if there is a usable result for the stingray.Tus.get() operation.

You can retrieve the result by calling stingray.Tus.get_result().

Parameters

target :

string?

The target for which you want to set the values. This can be nil (in which case the first logged in user is used), a SceNpId to set the value for a user, or a SceNpTusVirtualUserId to set the value for a virtual user.

The ? notation indicates that this type is optional: there may be zero or one instances of it.

options :

any(integer, number)*

The slots followed by their values.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
The * notation indicates that there may be zero or more instances of the specified type.
Returns

integer

Returns an ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

For example:

stingray.Tus.set(target, slot_1, value_1, slot_2, value_2, ...)
Parameters

target :

any

The target for the operation.

slot :

integer

The slot for setting the data and info.

data :

string

The data to set.

info :

string?

Optional. The information to set.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

integer

An ID for the operation, which you can pass to stingray.Tus.status() to track the progress of the operation.

Parameters

id :

integer

The ID for the operation.

Returns

integer

The status of the operation with the specified ID. May be any of the status code constants.

Result format constants

Pass one of these values in each call to [get_results()] in order to specify the level of detail you want to retrieve about the slots.

Status codes

May be returned by calls to status().

COMPLETED : integer

The operation has successfully completed.

ERROR : integer

An error occurred during the operation.

STARTED : integer

The operation has started, but not yet finished.

UNKNOWN : integer

Either the ID was never created, or it has already been freed.