nut.data
Data Persistence Utility.
Handles saving, retrieving, and deleting persistent framework or schema data in the nutscript/
folder.
Functions
nut.data.set (key, value, global, ignoreMap)
nut.data.set
Set and save data in the nutscript folder.
Parameters:
string key The name of the data filevararg value The value to save (must be encodable via pon)
boolean
global
optional. default
: false
If true, shared across all schemas
boolean
ignoreMap
optional. default
: false
If true, ignores map-specific folder
Returns:
string Full file path where the data was savednut.data.get (key, default, global, ignoreMap, refresh)
nut.data.get
Retrieves a saved value from the nutscript folder. Optionally returns cached value unless refreshed.
Parameters:
string key The data keyvararg default Value to return if key is not found
boolean
global
optional. default
: false
If true, shared across all schemas
boolean
ignoreMap
optional. default
: false
If true, ignores map-specific folder
boolean
refresh
optional. default
: false
If true, bypasses cache and reads file
Returns:
any The stored valueOr
default The fallback value if not foundnut.data.delete (key, global, ignoreMap)
nut.data.delete
Deletes a saved value. Removes both the file and its cache entry.
Parameters:
string key The data keyboolean
global
optional. default
: false
If true, shared across all schemas
boolean
ignoreMap
optional. default
: false
If true, ignores map-specific folder