rilua 0.1.21

Lua 5.1.1 implemented in Rust, targeting the World of Warcraft addon variant.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- Closure creation and upvalue access: stresses closure allocation.
-- Uses function-statement syntax for compatibility.
function counter()
    local n = 0
    return function()
        n = n + 1
        return n
    end
end

local c = counter()
local s = 0
for i = 1, 500000 do
    s = s + c()
end
print(s)