luna-core 2.13.0

Pure-Rust Lua runtime (interpreter only, zero third-party dependencies). The JIT-equipped variant lives in the `luna-jit` crate.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- v2.13 CORPUS-IV: `local function` binds the name BEFORE the
-- body (self-recursion works); `local f = function` does not.
local function fact(n)
  if n <= 1 then return 1 end
  return n * fact(n - 1)
end
print(fact(6))
local ok = pcall(load([[
  local g = function(n) if n <= 0 then return 0 end return g(n - 1) end
  return g(3)
]]))
print(ok)
local function even(n) if n == 0 then return true else return not even(n - 1) end end
print(even(10), even(7))