aboutsummaryrefslogtreecommitdiff
path: root/challenge-150/deadmarshal/lua/ch-1.lua
blob: e6e06733298579df261ddfd0a6aace193ed364e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
assert(#arg == 2, "provide 2 args!")

local function fibonacci_words(t)
  assert(type(t) == "table", "t must be a table!") 
  repeat
    t[#t+1] = t[#t-1] .. t[#t]
  until #t[#t] >= 51
  local chars = {}  
  for i=1, #t[#t] do
    local c = t[#t]:sub(i,i)
    chars[#chars+1] = c
  end
  return chars[51]
end

print(fibonacci_words({arg[1], arg[2]}))