summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/runtime/features/lambda_use_self.gd
blob: 3d063869ab74fe38064798b5ab0bef300398a5fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var member = "foo"

func bar():
	print("bar")

func test():
	var lambda1 = func():
		print(member)
	lambda1.call()

	var lambda2 = func():
		var nested = func():
			print(member)
		nested.call()
	lambda2.call()

	var lambda3 = func():
		bar()
	lambda3.call()

	var lambda4 = func():
		return self
	print(lambda4.call() == self)