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
15
-- v2.11 CORPUS-II: table.concat + __tostring.
-- table.concat requires string/number elements, but list.concat is
-- often mixed via explicit tostring wrap.
local items = {1, "two", 3, "four"}
local strs = {}
for i, v in ipairs(items) do strs[i] = tostring(v) end
print(table.concat(strs, "-"))

-- non-primitive via explicit conversion
local V = {}
V.__tostring = function(v) return "<" .. v.tag .. ">" end
local a = setmetatable({tag="A"}, V)
local b = setmetatable({tag="B"}, V)
print(tostring(a), tostring(b))
print(tostring(a) .. "|" .. tostring(b))