aboutsummaryrefslogtreecommitdiff
path: root/challenge-243/deadmarshal/lua/ch-2.lua
blob: c71dfcc814996cfb84a8f6263a0f1acb4904bfdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env lua

local function floor_sum(t)
  assert(type(t) == 'table','t must be a table!')
  local sum = 0
  for i=1,#t do
    for j=1,#t do
      sum = sum + (t[i] // t[j])
    end
  end
  return sum
end

print(floor_sum{2,5,9})
print(floor_sum{7,7,7,7,7,7,7})