DurableStore type
Shared durable stores. Calls yield; pcall catches structured errors such as {err = "conflict", version = 3}. One store per experience.
Functions 8
durableStore:get(key: string) → (any, number)Returns a fact's value and its version; version 0 means absent.
durableStore:set(key: string, value: any, if_version: number, lease: number?) → numberWrites a fact if its version is still if_version, and returns the new version. A mismatch errors with {err = "conflict"}.
durableStore:delete(key: string, if_version: number, lease: number?)Removes a fact if its version is still if_version.
durableStore:increment(key: string, by: number) → numberAdds by to a number atomically, starting at zero, and returns the result. Never retry it blindly after a timeout.
durableStore:list(prefix: string?, cursor: string?, limit: number?) → ({string}, string?)Returns fact keys with this prefix and the cursor for the next page, or nil at the end.
durableStore:blob_get(owner: string, key: string) → (string?, number)Returns one player's binary blob, or nil, and its version; owner is the player's uuid.
durableStore:blob_put(owner: string, key: string, bytes: string, if_version: number, lease: number?) → numberWrites a player's binary blob if its version is still if_version, and returns the new version. At most 32 MiB.
durableStore:blob_delete(owner: string, key: string, if_version: number, lease: number?)Deletes a player's blob if its version is still if_version.