Skip to content

Instantly share code, notes, and snippets.

@atirut-w
Created November 14, 2020 06:10
Show Gist options
  • Save atirut-w/420008f6391e8aade3f85a0422564ae3 to your computer and use it in GitHub Desktop.
Save atirut-w/420008f6391e8aade3f85a0422564ae3 to your computer and use it in GitHub Desktop.
function math.average(t)
local sum = 0
for _,v in pairs(t) do -- Get the sum of all numbers in t
sum = sum + v
end
return sum / #t
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment