17 lines
224 B
Lua
17 lines
224 B
Lua
function Fibonacci(total)
|
|
a = 1
|
|
b = 1
|
|
for n = 0, total do
|
|
if n == 0 then
|
|
return 0
|
|
elseif n == 1 or n == 2 then
|
|
return 1
|
|
else
|
|
c = a + b
|
|
a = b
|
|
b = c
|
|
end
|
|
end
|
|
return b
|
|
end
|