Skip to main content

Storage (storage)

Allows you to write configuration files with ease, without any headaches.

Variables

bool is_open = false

Don't modify

Do not modify this.

Indicates if a storage file is currently open.

Functions

bool open_storage(String location, bool create_new = true, bool sanity_check = true, bool fail_on_sanity_check = false)

Loads a storage file into memory.

bool close_storage()

Closes the active storage file.

bool save_storage()

Saves the active storage file to disk.

bool nuke_storage(bool autosave = true)

Removes all keys from the active storage file. The nuclear option basically.

Variant get_key(String key, Variant default = null)

Returns a storage key. Can also return a default value if unset.

bool set_key(String key, Variant value, bool overwrite = true, bool autosave = true)

Updates a storage key with the specified value.

bool del_key(String key, bool autosave = true)

Deletes a storage key.

Dictionary get_dict()

Returns the storage Dictionary, useful for more advanced operations.
Changes are not reflected onto the storage dictionary though. To save changes through this module, pass your modified dictionary to save_dict.

bool save_dict(Dictionary dict, bool sanity_check = true, bool fail_on_sanity_check = false, bool autosave = true)

Saves a arbitrary dictionary as a storage dictionary with sanity checking (sanity_check and fail_on_sanity_check).

Array[String] perform_sanity_check(Dictionary storage_check)

Performs sanity checks on a [class Dictionary] to determine if it can be saved and loaded using this module.