Lua

Lua

Installation

Ubuntu
apt install lua{version}
Alma Linux
dnf install lua
Arch Linux
pacman -S lua
Source Code
# Download lua-{version}.tar.gz from https://www.lua.org/
tar xzf lua-{version}.tar.gz
cd lua-{version}
make
make install

Examples

Fibonacci Numbers
-- Fibonacci Numbers
function fib(n)
    if n < 2 then
        return n
    else
        return fib(n - 2) + fib(n - 1)
    end
end

n = tonumber(arg[1])
print(fib(n))

--[[
example
    lua fib_lua.lua 39
    luajit fib_lua.lua 39
--]]