20.09.2019, 12:00
OK, so I was able to do it with the tips I got. Thanks for help!
If anyone alse need this function, just copy this code and modify to your liking;
If anyone alse need this function, just copy this code and modify to your liking;
Code:
start = '26/0/0'
stop = '26/0/255'
------------------------------------------------------------------------------------
--------------------NO CHANGES BELOW THE LINE---------------------------------------
startHG = tonumber(string.split(start, '/')[1])
startMG = tonumber(string.split(start, '/')[2])
startUG = tonumber(string.split(start, '/')[3])
startID = (startHG * 2048) + (startMG * 256) + startUG
stopHG = tonumber(string.split(stop, '/')[1])
stopMG = tonumber(string.split(stop, '/')[2])
stopUG = tonumber(string.split(stop, '/')[3])
stopID = (stopHG * 2048) + (stopMG * 256) + stopUG
if stopID < startID then
log('Start has higher value than stop. Delete is not possible')
else
log('Addresses within range are deleted')
adresser = db:getall('SELECT address, name FROM objects WHERE ID BETWEEN "' .. startID .. '" AND "' .. stopID .. '"')
for _, addr in ipairs(adresser) do
log(addr.name)
grp.delete(addr.name)
end
end
There are 10 kinds of people in the world; those who can read binary and those who don't