21.09.2021, 19:31
Thanks, this is very helpful.
I am using an event script, sometimes it's called with value 'on' and sometimes 'off' - in this case, I assumed I'll need to store the backuplist in storage, is something like the below the correct approach?
I am using an event script, sometimes it's called with value 'on' and sometimes 'off' - in this case, I assumed I'll need to store the backuplist in storage, is something like the below the correct approach?
Code:
backuplist = { '1/1/1', '1/1/2' }
-- save current values
values = {}
for _, addr in ipairs(backuplist) do
values[ addr ] = grp.getvalue(addr)
end
storage.set('backuplist', values)
...
-- restore values
values = storage.get('backuplist')
for addr, value in pairs(values) do
grp.write(addr, value)
end
Thank you!
Morkov
Morkov