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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
const a, b, c, d = 1, 2, 3, 4
do
close a, b = setmetatable {},__close:=> print "closed"
const c, d = 123, 'abc'
close a, b
const c, d
do
const a, {b, c}, {d} = f!, f1!
do
const a, {b, c}, {d} = f!
do
const [a, b] = [2, 3]
do
close v = if flag
func!
else
setmetatable {},__close:=>
close f = with io.open "file.txt"
\write "Hello"
do
const a = 1 if true
close b = (if x then 1) unless false
const c = (switch x
when "abc" then 998) if true
close d =
:value if a ?? b
do
close _ = with io.open "file.txt"
\write "Hello"
close _ = <close>: -> print "second"
close _ = <close>: -> print "first"
print "third"
_defers = setmetatable {}, __close: =>
@[#@]!
@[#@] = nil
def = (item)->
_defers[#_defers + 1] = item
_defers
do
close _ = def -> print 3
close _ = def -> print 2
close _ = def -> print 1
|