remedy-lua 0.1.2

A Lua 5.4 superset in safe Rust for running untrusted scripts: exact fuel, memory and depth limits, an incremental collector, an optional typed dialect and a capability-based host API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Closure creation, upvalue reads/writes, higher-order calls.
local function counter()
  local n = 0
  return function(k) n = n + k; return n end
end
local function compose(f, g) return function(x) return f(g(x)) end end
local total = 0
for i = 1, 200000 do
  local c = counter()
  c(i)
  total = total + c(1)
  local h = compose(function(x) return x + 1 end, function(x) return x * 2 end)
  total = total + h(i)
end
local acc = counter()
for _ = 1, 1000000 do acc(1) end
return tostring(total + acc(0))