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.

Read from log.
#4
Scheduled script that runs every minute. It will store latest 60 object values for the given address. oldvalue variable will contain the oldest entry in the list. It will be 1 hour long when the list accumulates 60 entries.
Code:
addr = '0/0/1'
key = 'values_' .. addr
max = 60

newvalue = grp.getvalue(addr)

storage.exec('lpush', key, newvalue)
storage.exec('ltrim', key, 0, max - 1)

oldvalue = storage.exec('lindex', key, -1)
oldvalue = tonumber(oldvalue)

log(newvalue, oldvalue)
Reply


Messages In This Thread
Read from log. - by tomnord - 24.10.2023, 10:47
RE: Read from log. - by admin - 24.10.2023, 10:52
RE: Read from log. - by tomnord - 24.10.2023, 11:00
RE: Read from log. - by admin - 24.10.2023, 11:08

Forum Jump: