08.04.2024, 14:32
(This post was last modified: 08.04.2024, 14:43 by manos@dynamitec.)
(08.04.2024, 14:07)admin Wrote: Try this:
Code:tags = {
{ tag = 'tag1', output = '1/1/1' },
{ tag = 'tag2', output = '2/1/1' },
}
function tag_max(tag)
local objects = grp.tag(tag)
local result = -math.huge
for _, object in ipairs(objects) do
result = math.max(result, object.value)
end
return result
end
for _, t in ipairs(tags) do
max = tag_max(t.tag)
grp.checkwrite(t.output, max)
os.sleep(0.1)
end
Thank you Admin. Works as expected .
If I want to also calculate the min value in the same script and write on diff object?