Data Module
The data module stores persistent save data. The cache module stores temporary session data.
Data Module
Section titled “Data Module”LAU provides 3 save slots: 1, 2, and 3.
| Function | Arguments | Description |
|---|---|---|
data.save(slot, list) | number, list | Saves a table to the specified slot. |
data.load(slot) | number | Returns the table stored in that slot, or null. |
data.clear(slot) | number | Permanently deletes all data in that slot. |
lau-compiler.exe
varol mySettings = { speed = 25, autoSell = true }
data.save(1, mySettings)print("[Data] Settings saved to Slot 1!")
varol loaded = data.load(1)print("[Data] Loaded Speed: " + loaded.speed)OUTPUT:
[Data] Settings saved to Slot 1!
[Data] Loaded Speed: 25
Cache Module
Section titled “Cache Module”The cache module is temporary session storage. It works like a small list of values you can add, read, remove, and reset during the current run.
| Function | Returns | Description |
|---|---|---|
cache.set(key, value) | void | Stores a value for the current session. |
cache.get(key) | any | Gets a cached value, or null if it does not exist. |
cache.remove(key) | void | Removes one cached value. |
cache.reset() | void | Clears all cached values. |
Example: Save And Read Cache Values
Section titled “Example: Save And Read Cache Values” lau-compiler.exe
cache.set(1, "apples")cache.set(2, "carrots")
print("[1] " + cache.get(1))print("[2] " + cache.get(2))OUTPUT:
[1] apples
[2] carrots
Example: Remove And Reset Cache
Section titled “Example: Remove And Reset Cache”cache.set(1, "hello")cache.remove(1)
cache.set(1, 1)cache.set(2, 2)cache.reset()cache.set(1, "farmMode")print("Cache mode: " + cache.get(1))