This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Multi OR port
#2
Hi,

grp.tag will always return a table with objects so this is never true or false..

Here are the needed scripts for logical and/or by TAG:
Code:
-- Logical OR port by tagged objects
tagname = 'OR_LOGIC'
output = '1/1/1'
for i, object in ipairs(grp.tag(tagname)) do
  if object.data then
    grp.checkwrite(output, true, 1)
    return
 end
end
grp.checkwrite(output, false, 1)

Code:
-- Logical AND port by tagged objects
tagname = 'AND_LOGIC'
output = '1/1/1'  
for i, object in ipairs(grp.tag(tagname)) do
 if not object.data then
   grp.checkwrite(output, false, 1)
   return
 end
end
grp.checkwrite(output, true, 1)
BR,

Erwin
Reply


Messages In This Thread
Multi OR port - by fabiorusco - 21.01.2019, 15:38
RE: Multi OR port - by Erwin van der Zwart - 21.01.2019, 21:51
RE: Multi OR port - by Daniel - 22.01.2019, 08:31
RE: Multi OR port - by MantasJ - 24.01.2019, 14:53
RE: Multi OR port - by Daniel - 24.01.2019, 15:00
RE: Multi OR port - by MantasJ - 24.01.2019, 15:55
RE: Multi OR port - by Daniel - 24.01.2019, 16:07
RE: Multi OR port - by Erwin van der Zwart - 24.01.2019, 16:49

Forum Jump: