Coming soon toSteam
Modding docsAPI 1

Module · Scripting core

storage

Persistent key/value data that survives restarts, saved automatically every 30 seconds and when the mod unloads. Client scripts and server scripts each have their own storage; the quota is 4 MB per side.

storage.clear()

Removes every key.

storage.get(key: string, fallback?: any): any

The stored value, or fallback when the key is not set.

local best = storage.get("bestTime", 999)

storage.has(key: string): boolean

True when the key is set.

storage.keys(): string[]

Every stored key.

storage.remove(key: string)

Removes a key.

storage.save()

Writes pending changes to disk immediately.

storage.set(key: string, value: any)

Stores a value (tables, strings, numbers, booleans, vec3/quat/color). Setting nil removes the key.

storage.set("bestTime", 42.5)

storage.usage(): ...

How much of the quota is used.

Returns bytes used, quota in bytes