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.

Tag value chek function
#2
Use this:
Code:
objs = grp.tag('mytag')
mindelta = 2 * 60 * 60 -- 2 hours

now = os.time()
errors = {}

for _, obj in ipairs(objs) do
  delta = now - obj.updatetime

  if delta >= mindelta or obj.value < 50 then
    errors[ #errors + 1 ] = string.format('Name: %s, Value: %d, Updated: %s',
      obj.name, obj.value, os.date('%c', obj.updatetime))
  end
end

if #errors > 0 then
  text = table.concat(errors, '\n')
  log(text)
end
Reply


Messages In This Thread
Tag value chek function - by a455115 - 24.10.2022, 14:33
RE: Tag value chek function - by admin - 25.10.2022, 09:58
RE: Tag value chek function - by a455115 - 26.10.2022, 06:49
RE: Tag value chek function - by admin - 26.10.2022, 06:50

Forum Jump: