Persist Data in Lua / LS300

Hi,

I’m attempting to persist data over reboots using this type of command when triggered via an AirVantage data download:

local persist = require ‘persist’

persist.save(‘ip’,‘192.168.10.20’)

At start up my Lua app loads the value that may have been stored using:

local ip = persist.load(‘ip’)

Unfortunately the ip value is always nil. What am I doing wrong?

I was following these docs:
https://source.sierrawireless.com/resources/airlink/aleos_af/refdoc_aleos_af_api/#url=~/media/Support_Downloads/AirLink/AAF/aleos_af-1_0_0-api/API_Table_persist.html&id=iframe0.

ALEOS Software Version: 4.4.4 ALEOS Build number: 004
Device Model: LS300

Thanks in advance.

Steve

Hi stEngDev,

In what ‘context’ are you executing your application? Are installing your app, or running it using the "run as " button in the Dev Studio? (i.e. not installed)
When you do not install the app (i.e. “run as”) it does not create the persist store on the device for this app. The data is only written to RAM so it does not survive reboot.

The persist API only works when you install your application.
Can you confirm your context use case ?

Ah, I am debugging… I will install and test.

Yup, that was the problem. Thanks for that.