luna-core 2.11.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
18
-- v2.10 CORPUS: collectgarbage + weak tables.
local weak = setmetatable({}, {__mode = "v"})
local strong = {}
for i = 1, 3 do
  local t = {i = i}
  strong[i] = t
  weak[i] = t
end
collectgarbage("collect")
print(#strong, weak[1].i, weak[2].i, weak[3].i)  -- 3 1 2 3

-- clear strong refs
for i = 1, 3 do strong[i] = nil end
collectgarbage("collect")
-- weak entries should be gone
local n = 0
for _ in pairs(weak) do n = n + 1 end
print(n)  -- 0