aboutsummaryrefslogtreecommitdiff
path: root/testes/closure.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testes/closure.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/testes/closure.lua b/testes/closure.lua
index 27ec5596..de1b54ec 100644
--- a/testes/closure.lua
+++ b/testes/closure.lua
@@ -4,7 +4,7 @@
4print "testing closures" 4print "testing closures"
5 5
6local A,B = 0,{g=10} 6local A,B = 0,{g=10}
7function f(x) 7local function f(x)
8 local a = {} 8 local a = {}
9 for i=1,1000 do 9 for i=1,1000 do
10 local y = 0 10 local y = 0
@@ -86,6 +86,7 @@ assert(r == 2 and s == "a")
86 86
87 87
88-- testing closures with 'for' control variable x break 88-- testing closures with 'for' control variable x break
89local f
89for i=1,3 do 90for i=1,3 do
90 f = function () return i end 91 f = function () return i end
91 break 92 break
@@ -136,7 +137,7 @@ assert(b('get') == 'xuxu')
136b('set', 10); assert(b('get') == 14) 137b('set', 10); assert(b('get') == 14)
137 138
138 139
139local w 140local y, w
140-- testing multi-level closure 141-- testing multi-level closure
141function f(x) 142function f(x)
142 return function (y) 143 return function (y)
@@ -227,6 +228,7 @@ t()
227-- test for debug manipulation of upvalues 228-- test for debug manipulation of upvalues
228local debug = require'debug' 229local debug = require'debug'
229 230
231local foo1, foo2, foo3
230do 232do
231 local a , b, c = 3, 5, 7 233 local a , b, c = 3, 5, 7
232 foo1 = function () return a+b end; 234 foo1 = function () return a+b end;