I am still working with lists/arrays and i have a question, i want to add all the items in the list what i mean is if i have an array like so: {3,2,3,1,3}
the output should be 12
how would i do this?
this should workd:
total = 0 array = {3,2,3,1,3} for _,n in ipairs(array) do total+=n end
This works for me when i have to get the sum
Add = {1, 2, 3, 4} local sum = 0 table.foreach(Add, function(i, v) sum = sum + v end) print(sum)