01.09.2021, 12:37
Try this:
Code:
rows = db:getall([[
SELECT ol.id, ol.datahex, o.datatype
FROM objectlog ol
JOIN objects o ON ol.address=o.id
]])
for _, row in ipairs(rows) do
if row.datahex then
value = busdatatype.decode(row.datahex, row.datatype)
if type(value) == 'number' and value <= 0 then
db:delete('objectlog', { id = row.id })
end
end
end