04.12.2015, 07:26
Or you can make a script to save/recall values of all objects mapped to a certain tag. Map this script to a binary object, where ON saves tagged object values and OFF recalls saved values.
Code:
value = event.getvalue()
-- save states
if value then
objects = grp.tag('my_object_tag')
store = {}
for _, object in ipairs(objects) do
store[ object.address ] = object.data
end
storage.set('my_objects', store)
-- restore states
else
store = storage.get('my_objects', {})
for addr, value in pairs(store) do
grp.write(addr, value)
end
end