19.01.2021, 14:43
In this example each fault object has the next middle group (shift = 256, 1/1/123 => 1/2/123). Change as needed, shift can be negative.
Code:
function tag_max(tag, shift)
local objects = grp.tag(tag)
local result = -math.huge
for _, object in ipairs(objects) do
local fault = grp.getvalue(object.id + shift)
if not fault then
result = math.max(result, object.value)
end
end
return result
end
max = tag_max('my_tag_name', 256)
log(max)