Store
Reads and writes a named persistent key-value store.
Behavior
Open a Store through StorageService:Open(name, scope?). Operations are available to server scripts and yield until the host replies. Service failures cause errors; wrap requests in pcall when handling failure. Store names and scopes must contain 1 to 50 bytes. Keys must contain 1 to 49 bytes. Encoded values must be smaller than 64 KiB.
Summary
Delete(key: string): ()Deletes the stored key.
Get(key: string): anyReads a key and returns its stored value, or nil when no value exists.
Increment(key: string, delta: number?): numberAtomically adds an integer delta to the stored numeric value.
Set(key: string, value: any): ()Writes a JSON-compatible value at the key.
Update(key: string, transform: (old: any) -> any): anyReads the current value, calls transform(current), and conditionally writes the result.
Methods
Delete
Store:Delete(key: string): ()Deletes the stored key. Returns no value.
Get
Store:Get(key: string): anyReads a key and returns its stored value, or nil when no value exists.
Increment
Store:Increment(key: string, delta: number?): numberAtomically adds an integer delta to the stored numeric value. The delta defaults to 1. Returns the resulting value.
Set
Store:Set(key: string, value: any): ()Writes a JSON-compatible value at the key. Returns no value.
Update
Store:Update(key: string, transform: (old: any) -> any): anyReads the current value, calls transform(current), and conditionally writes the result. The callback can run again after a conflicting write; avoid side effects in it. Returning nil cancels the write. The operation fails after 16 conflicting-write retries.
Operators
__index · __tostring · __type