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.

Is it possible to tag/untag an object with a digital value?
#4
Instead of changing tags you can simply tag on/off objects with a different tag. The number of tagged objects for both max and status tags must be the same. It also makes sense to map this script to both value and status objects. A different common tag can be be used for this.
Code:
function sortbyid(a, b)
  return a.id < b.id
end

objs = grp.tag('max')
table.sort(objs, sortbyid)

stat = grp.tag('status')
table.sort(stat, sortbyid)

max = -math.huge

for i, obj in ipairs(objs) do
  if stat[ i ].value then
    max = math.max(obj.value, max)
  end
end

log(max)
Reply


Messages In This Thread
RE: Is it possible to tag/untag an object with a digital value? - by admin - 06.06.2022, 07:07

Forum Jump: