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

local function smallest_index(t)
  assert(type(t) == 'table','t must be a table!')
  for i=1,#t do
    if i % 10 == t[i]+1 then return i-1 end
  end
  return -1
end

print(smallest_index{0,1,2})
print(smallest_index{4,3,2,1})
print(smallest_index{1,2,3,4,5,6,7,8,9,0})