23.06.2022, 14:00
Hello, how can I simplify the script following this criterion?
Code:
-- scheduler1
id = 1
active = db:getone('SELECT active FROM schedulers WHERE id=?', id)
active = toboolean(active)
grp.checkupdate('40/0/' .. id, active)
-- scheduler2
id = 2
active = db:getone('SELECT active FROM schedulers WHERE id=?', id)
active = toboolean(active)
grp.checkupdate('40/0/' .. id, active)
-- scheduler3
id = 3
active = db:getone('SELECT active FROM schedulers WHERE id=?', id)
active = toboolean(active)
grp.checkupdate('40/0/' .. id, active)
-- scheduler4
id = 4
active = db:getone('SELECT active FROM schedulers WHERE id=?', id)
active = toboolean(active)
grp.checkupdate('40/0/' .. id, active)
-- scheduler5
id = 5
active = db:getone('SELECT active FROM schedulers WHERE id=?', id)
active = toboolean(active)
grp.checkupdate('40/0/' .. id, active)