clear_all_staged_values
$persistence.clear_all_staged_values(user: User)Removes all staged values for the given user.
| Parameter | Type | Meaning |
|---|---|---|
user | User | The user the value belongs to. |
Values saved between sessions.
15 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).
$persistence.clear_all_staged_values(user: User)Removes all staged values for the given user.
| Parameter | Type | Meaning |
|---|---|---|
user | User | The user the value belongs to. |
$persistence.get_key_exists(key: string, key_list: list, user: User) -> boolDetermine if a key exists already.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to search for. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the key belongs to. |
Returns bool: True if the key exists.
$persistence.get_nth_staged_key(n: int, user: User) -> stringReturn the nth key of staged data for the given user.
| Parameter | Type | Meaning |
|---|---|---|
n | int | Which index to return. |
user | User | The user the value belongs to. |
Returns string: The key string.
$persistence.get_staged_key_count(user: User) -> intReturn how many staged keys have been set for the given user.
| Parameter | Type | Meaning |
|---|---|---|
user | User | The user the value belongs to. |
Returns int: The number of staged keys that have been set.
$persistence.get_staged_value(key: string, key_list: list, user: User) -> intGets a staged value for the given user.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to access. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns int: The staged value for the key, or -1 if not found. Use persistence.has_staged_key(...) if you need to be sure of its existence.
$persistence.get_value_as_float(key: string, key_list: list, user: User) -> floatGet a persistent value from the backend services as a float.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to retrieve this value. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns float: The value stored for this key as a float.
$persistence.get_value_as_int(key: string, key_list: list, user: User) -> intGet a persistent value from the backend services as an int.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to retrieve this value. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns int: The value stored for this key as an int.
$persistence.get_value_as_object_ref(key: string, key_list: list, user: User) -> ReferenceGet a persistent value from the backend services as a ref to a loaded object. Returns null if the specified object is not loaded, or not found.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to retrieve this value. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns Reference: The value stored for this key as a ref.
$persistence.get_value_as_string(key: string, key_list: list, user: User) -> stringGet a persistent value from the backend services as a string.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to retrieve this value. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns string: The value stored for this key as a string.
$persistence.get_value_as_world_time_delta_ms(key: string, key_list: list, user: User) -> intGet a duration in milliseconds since the time set via set_world_time_value. If the duration is too large, will return INT_MAX and not warn.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to retrieve this value. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns int: The duration in milliseconds.
$persistence.has_received_persistence_for_user(user: User) -> boolDetermine if we have received persistence values from the backend for a particular user. The user's persistence may be empty.
| Parameter | Type | Meaning |
|---|---|---|
user | User | The user to query. |
Returns bool: True if we have received an update for this user, false otherwise.
$persistence.has_staged_key(key: string, key_list: list, user: User) -> boolDetermine if there exists a key in the staged data.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key look for. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
Returns bool: Whether the key exists or not.
$persistence.set_staged_value(key: string, key_list: list, user: User, value: int, flags: int)Sets a staged value for the given user.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to store this value under. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
value | int | The value to store. |
flags | int | The flags for the key. See vgame_persistence_staged_value_flags_t. |
$persistence.set_value(key: string, key_list: list, user: User, value: var, write_type: int)Sets a persistent value in the backend services. get_value may not immediately return this value, until it receives it from the backend.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to store this value under. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
value | var | The value to store. |
write_type | int | Write behavior e.g. k_online_write_type_replace (default), k_online_write_type_greater_than. |
$persistence.set_world_time_value(key: string, key_list: list, user: User, offset_ms: int)Sets a persistent value in the backend services to the current world time in nanoseconds. The value is accessible via get_value_as_world_time_delta_ms.
| Parameter | Type | Meaning |
|---|---|---|
key | string | The unique key to store this value under. |
key_list | list | List to use as the unique key. Will be used over 'key' parameter if specified. |
user | User | The user the value belongs to. |
offset_ms | int | An offset in millseconds to the time to set. |