diff --git a/Storage.md b/Storage.md new file mode 100644 index 0000000..a7cb7e9 --- /dev/null +++ b/Storage.md @@ -0,0 +1,32 @@ +The Storage module allows you to store values to permanently for later use, useful for things like settings and highscores. + +## Overview +* [ProfileStorage](https://github.com/SpoinkyNL/Artemis/wiki/storage#profilestorage) +* [GlobalStorage](https://github.com/SpoinkyNL/Artemis/wiki/storage#globalstorage) + +## 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: +```lua +-- Set a value the same way as a regular LUA table +ProfileStorage["highscore"] = 500; + +-- Retrieve the value at a later time +local lastHighscore = ProfileStorage["highscore"]; +``` +--- +### 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: +```lua +-- Set a value the same way as a regular LUA table +GlobalStorage["favoriteColor"] = "blue"; + +-- Retrieve the value at a later time +local favoriteColor = GlobalStorage["favoriteColor"]; +``` \ No newline at end of file