The Storage module allows you to store values to permanently for later use, useful for things like settings and highscores.
Overview
Usage
ProfileStorage
Used to store a value within the profile.
This is the preferred place to store things since it is not accesable outside the script's profile.
Example:
GlobalStorage
Used to store a value globally within Artemis.
Anything you store here can be accessed by all LUA scripts, this is useful if you have settings that you want to reuse in other scripts.
Note: When storing things here other scripts could overwrite your value so make sure to pick a unique name.
Example:
Notes
A few things to keep in mind when storing values
- You can only store primitive types and tables (which can also only contain primitive types). If you try to store something else Artemis will not save any of your settings.
- If you try to access a value that has never been set before, you'll get
nil so be sure to check for that, especially when concatenating strings.
- Values are read from disk when the script is loaded and stored to disk when the script is unloaded.