Skip to content

ax.data

Source: gamemode/framework/libraries/sh_data.lua

Simple data persistence helpers.

Documented functions: 3

Functions


ax.data:Delete(key, options)

Delete a stored file.

Realm: shared

Parameters

Name Type Description
key string -
options table Optional. Fields: - scope: "global"|"project"|"map" (default: "project")

Usage

ax.data:Delete("settings_player", { scope = "project" })

ax.data:Get(key, default, options)

Load a value from disk.

Realm: shared

Parameters

Name Type Description
key string -
default any Value returned if the file does not exist.
options table Optional. Fields: - scope: "global"|"project"|"map" (default: "project") - force: boolean If true, bypass cache and read from disk

Returns

  • any

Usage

local cfg = ax.data:Get("settings_player", {}, { force = false })

ax.data:Set(key, value, options)

Save a value to disk.

Realm: shared

Parameters

Name Type Description
key string Unique key used to name the file.
value any Value to persist. Tables are serialized as JSON.
options table Optional. Fields: - scope: "global"|"project"|"map" (default: "project") - human: boolean If true, writes pretty JSON (.json extension) - noCache: boolean If true, clears cache after writing

Usage

ax.data:Set("settings_player", { volume = 0.8 }, { scope = "project", human = true })