This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Polling status
#7
(04.12.2015, 07:26)admin Wrote: 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
Sorry, Can you tell me more about the above code? I don't understand how to apply it yet.

Thanks!
Reply


Messages In This Thread
Polling status - by FatMax - 02.12.2015, 22:45
RE: Polling status - by gjniewenhuijse - 03.12.2015, 09:03
RE: Polling status - by FatMax - 04.12.2015, 05:55
RE: Polling status - by gjniewenhuijse - 04.12.2015, 06:51
RE: Polling status - by admin - 04.12.2015, 07:26
RE: Polling status - by TranVanHieu - 30.08.2023, 07:51
RE: Polling status - by FatMax - 04.12.2015, 23:16
RE: Polling status - by admin - 30.08.2023, 07:58
RE: Polling status - by TranVanHieu - 30.08.2023, 09:14
RE: Polling status - by admin - 30.08.2023, 09:22
RE: Polling status - by TranVanHieu - 30.08.2023, 09:35

Forum Jump: