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
-- v2.12 CORPUS-III: __index as table for prototype-style inheritance.
local Base = {name = "Base"}
function Base:hello() return "hi from " .. self.name end

local Derived = setmetatable({}, {__index = Base})
Derived.name = "Derived"

print(Derived:hello())     -- hi from Derived
print(Base:hello())        -- hi from Base

-- Instance of Derived
local instance = setmetatable({}, {__index = Derived})
instance.name = "instance"
print(instance:hello())    -- hi from instance