Logic Machine Forum
Search all Objects - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Search all Objects (/showthread.php?tid=3627)



Search all Objects - sjfp - 18.10.2021

Looking for help on how to count how many objects with a tag name of ALARM (250. byte string) which has current values like ARMED and another count for those that have DISARMED.
These can then be added to OBJECTs to include in a DASHBOARD


RE: Search all Objects - Daniel - 18.10.2021

Something like this
Code:
text='ARMED'
myobjects = grp.tag('ALARM')
sum = 0
  for _, obj in ipairs(myobjects) do
    if obj.value == text then
        sum = sum+1
    end
  end
log(sum)



RE: Search all Objects - sjfp - 18.10.2021

Many thanks Daniel