loadData

Built-ins

Canonical ID: storage.get. Nederlands: laadGegeven.

Loads a fresh copy of a saved value, or a fresh copy of the fallback when the key is absent. The fallback must be JSON-compatible too. Updating a returned collection does not write it back: call saveData explicitly to persist changes. None can be a saved value, so it is not automatically treated as a missing key.

Signature

loadData(key, fallback)

Arguments

Parameter Type Requirement
key Text Nonempty, no surrounding whitespace/control characters, at most 128 UTF-8 bytes.
fallback JSON-compatible Returned as a fresh copy when the key is absent.

Return value

saved value or fallback.

Example

# language: en
deleteData("new-score")
let fallback = [0]
let score = loadData("new-score", fallback)
set score[0] = 7
say fallback[0]

Prints 0; the fallback is copied.

Notes and common mistakes

Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.

Keys and saved text are not translated. Limits are 128 keys, 64 KiB per JSON value, 512 KiB per document, 32 nesting levels, and 8,192 values/nodes per value. Functions, nonfinite numbers, and Maps with non-Text keys cannot be stored. A usable portable project identity enables durable data; loose source uses temporary session storage. See the storage guide for E4014–E4017 and copy/identity rules.

saveData · deleteData · savedDataKeys · Programming guides · Host support · Calls and arguments