2023-09-25 05:23:53 +00:00
|
|
|
local function make_closure (x)
|
|
|
|
print (x)
|
|
|
|
return function (y)
|
|
|
|
return x + y
|
2023-09-25 01:40:28 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-09-25 05:23:53 +00:00
|
|
|
local f = make_closure (11)
|
2023-09-25 06:57:57 +00:00
|
|
|
local x = f (12)
|
|
|
|
print (x)
|
|
|
|
return x
|