mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 21:38:38 +00:00
Created Storage (markdown)
parent
ee1013acd4
commit
41011d9464
32
Storage.md
Normal file
32
Storage.md
Normal file
@ -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"];
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user