aboutsummaryrefslogtreecommitdiff
path: root/tests/rupval.lua
blob: 107916837de639f1a21c16fabbc76ffef2ef0915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
lanes = require "lanes".configure{with_timers=false}

-- make sure we can copy functions with interdependant upvalues

local x = 33
local y = 44
local z = 55

local b
local a = function( n)
	print( "a", n)
	return n <= 0 and x or b( n-1)
end

local c
b = function( n)
	print( "b", n)
	return n <= 0 and y or c( n-1)
end

c = function( n)
	print( "c", n)
	return n <= 0 and z or a( n-1)
end

local g = lanes.gen( "base", a)

local l = g(10)
local r = l:join()
print(r)