luna-core 2.12.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
15
16
17
-- v2.10 CORPUS: error propagation through nested pcall.
local function strip(e) return e:match(": (.+)$") or tostring(e) end
local function deep(n)
  if n == 0 then error("bottom") end
  return deep(n - 1)
end
local ok, err = pcall(deep, 5)
print(ok, strip(err))

-- error with non-string value
local ok2, err2 = pcall(function() error({code = 42, msg = "structured"}) end)
print(ok2, err2.code, err2.msg)

-- error level=2 (blames caller)
local function bad() error("level2-msg", 2) end
local ok3, err3 = pcall(bad)
print(ok3, strip(err3))