lunar_wave/test_vectors/closure.lua

12 lines
165 B
Lua

local function make_closure (t)
return function (y)
return t.x + y
end
end
local f = make_closure ({ x = 11 })
local t = {}
local x = f (12)
print (x)
return x