storage.write¶
since 1.1.0
Write a value to the current storage.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
label |
string | yes | |
value |
any | yes | the value to write |
Returns¶
Nothing.
Examples¶
local function write(widget)
storage.write("v", 2) -- settings version, for future migrations
storage.write("source", widget.source)
storage.write("threshold", widget.threshold)
end
Keep the keys and order in step with your read callback.
Used in¶
- Background alert task
- Battery gauge widget
- Lua source
- Timer control
- Telemetry value widget
- lazy-loading
- source
- task
- widget-gauge
- widget-jet
Real-world usage¶
Called 16 times across 3 open-source Ethos Lua projects. A few short excerpts: