25.10.2022, 09:58
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