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.

Summing Values
#2
Tag all objects you want to sum and you can use this

Code:
function tag_sum(tag)
  local objects, result

  result = 0
  objects = grp.tag(tag)

  for _, object in ipairs(objects) do
    result = result + object.data
  end

  return result
end



sum = tag_sum('TAG')
------------------------------
Ctrl+F5
Reply


Messages In This Thread
RE: Summing Values - by Daniel - 04.11.2019, 08:23
RE: Summing Values - by Daniel - 04.11.2019, 10:41
RE: Summing Values - by Daniel - 04.11.2019, 14:26
RE: Summing Values - by Tokatubs - 04.11.2019, 23:31
RE: Summing Values - by Daniel - 05.11.2019, 08:26

Forum Jump: