20.03.2019, 14:13
(19.03.2019, 06:35)Kai-Roger Wrote:(19.03.2019, 05:39)Erwin van der Zwart Wrote: Hi,
Are you sure your script works?
I would expect the command in true state before the return..
BR,
Erwin
Hi. Yes it does what i expected.
Here is how it responds:
But what i failed to do, was to use two of these codes after another in the same code. I think it stops at the first one, so i have to change something so that the scripts run every part of the code.
Not the prettiest script but atleast it works
Code:
tag = grp.tag('lights_1')
lights_on = 0
-- arraytable = { 'a', 'b', 'c' }
for i, value in ipairs(tag) do
local lights_status = grp.getvalue(value.address)
if lights_status == true then
lights_on = lights_on + 1
end
end
if lights_on == 0 then
log('All lights off')
else
log('Some lights are on')
end