Appearance
game.storage
Per-script storage. Names are 1..80 ASCII letters/digits/_/-/. and must not be . or ... Payloads are limited to 2 MiB.
Native global — no require.
read
function · read(name: string): string?, ErrorMessage?
Per-script storage. Names are 1..80 ASCII letters/digits/_/-/. and must not be . or ... Payloads are limited to 2 MiB.
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | — |
Returns
| Type | Summary |
|---|---|
string?, ErrorMessage? | — |
write
function · write(name: string, data: string): boolean, ErrorMessage?
Returns false, error on failure.
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | — |
data | string | — |
Returns
| Type | Summary |
|---|---|
boolean, ErrorMessage? | — |
remove
function · remove(name: string): boolean, ErrorMessage?
Returns false, error on failure.
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | — |
Returns
| Type | Summary |
|---|---|
boolean, ErrorMessage? | — |
path
function · path(name: string): string
Empty when the name or host is unavailable.
Parameters
| Name | Type | Summary |
|---|---|---|
name | string | — |
Returns
| Type | Summary |
|---|---|
string | — |
save_as
function · save_as(data: string, name?: string): boolean, ErrorMessage?
Starts a Save dialog on a worker thread. TEST host returns false.
Parameters
| Name | Type | Summary |
|---|---|---|
data | string | — |
name | string | — |
Returns
| Type | Summary |
|---|---|
boolean, ErrorMessage? | — |
open_as
function · open_as(): boolean, ErrorMessage?
Starts an Open dialog on a worker thread. TEST host returns false.
Returns
| Type | Summary |
|---|---|
boolean, ErrorMessage? | — |
dialog
function · dialog(): { state: 'idle'|'pending'|'ok'|'cancel'|'error', kind?: 'idle'|'save'|'open', path?: string, data?: string, error?: string }
Consumes a finished dialog.
Returns
| Type | Summary |
|---|---|
{ state: 'idle'|'pending'|'ok'|'cancel'|'error', kind?: 'idle'|'save'|'open', path?: string, data?: string, error?: string } | — |