01.09.2021, 12:08
It's more complicated. Value is stored raw format so it has to be decoded before comparison.
Code:
obj = grp.find('1/1/1')
rows = db:getall('SELECT * FROM objectlog WHERE address=?', obj.id)
for _, row in ipairs(rows) do
if row.datahex then
value = busdatatype.decode(row.datahex, obj.datatype)
if value <= 0 then
db:delete('objectlog', { id = row.id })
end
end
end