crayon-syntax-highlighter/util/sample/lua.txt
2019-08-30 19:30:19 +02:00

7 lines
341 B
Plaintext

fibs = { 1, 1 } -- Initial values for fibs[1] and fibs[2].
setmetatable(fibs, {
__index = function(name, n) -- Call this function if fibs[n] does not exist.
name[n] = name[n - 1] + name[n - 2] -- Calculate and memoize fibs[n].
return name[n]
end
})