Fibonacci in Lua

Published on 14 October 2019 (Updated: 14 October 2019)

Welcome to the Fibonacci in Lua page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

function fib(n)
  local a, b = 0, 1
  for k = 1, n do
    a, b = b, a + b
    print(k .. ": " .. a)
  end
end

if tonumber(arg[1]) ~= nil then
  n = tonumber(arg[1])
  print(fib(n))
else
  print("Usage: please input the count of fibonacci numbers to output")
end

Fibonacci in Lua was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.