nv.get()
nv.get([offset]) → string | undefined
Loads a string from non-volatile memory; undefined when no valid data is stored.
Reads the string stored at offset (default 0). Returns undefined if no
valid string is detected — this can happen if the memory backup battery goes
dead, so always handle the undefined case by falling back to defaults.
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| offset | number | optional | 0 | Byte offset within the 4 kB memory. |
Returns
string | undefined
The stored string, or undefined when nothing valid is stored.
Example
nv.set("abcd");
nv.set("1234",2048);
let msg1 = nv.get();
let msg2 = nv.get(2048);
print(msg1); // msg1 = "abcd"
print(msg2); // msg2 = "1234"