lia.data
Helper library for reading/writing files to the data folder.
Functions
delete(key, global, ignoreMap)
Deletes the contents of a saved file in the data/lilia
folder.
Parameters
-
key
String
Name of the file to delete
-
global
Boolean
default: false
Whether or not the data is in the
data/lilia
folder, or thedata/lilia/schema
folder, whereschema
is the name of the current schema.
-
ignoreMap
Boolean
default: false
Whether or not to ignore the map and delete from the schema folder, rather than
data/lilia/schema/map
, wheremap
is the name of the current map.
Returns
-
bool
Whether or not the deletion has succeeded
get(key, default, global, ignoreMap, refresh)
Retrieves the contents of a saved file in the data/lilia
folder.
Parameters
-
key
String
Name of the file to load
-
default
Value to return if the file could not be loaded successfully
-
global
Boolean
default: false
Whether or not the data is in the
data/lilia
folder, or thedata/lilia/schema
folder, whereschema
is the name of the current schema.
-
ignoreMap
Boolean
default: false
Whether or not to ignore the map and load from the schema folder, rather than
data/lilia/schema/map
, wheremap
is the name of the current map.
-
refresh
Boolean
default: false
Whether or not to skip the cache and forcefully load from disk.
Returns
-
any
Value associated with the key, or the default that was given if it doesn't exist
set(key, value, global, ignoreMap)
Populates a file in the data/lilia
folder with some serialized data.
Parameters
-
key
String
Name of the file to save
-
value
Some sort of data to save
-
global
Boolean
default: false
Whether or not to write directly to the
data/lilia
folder, or thedata/lilia/schema
folder, whereschema
is the name of the current schema.
-
ignoreMap
Boolean
default: false
Whether or not to ignore the map and save in the schema folder, rather than
data/lilia/schema/map
, wheremap
is the name of the current map.
Returns
-
string
The path where the file is saved