diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-05-09 12:10:31 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-05-09 12:10:31 -0300 |
| commit | d881325c2fcbb6d2c434ec403b0bbe51ac200c7b (patch) | |
| tree | 811c1a1ffa8f91693b8df64e040c509c2cec6ded /testes/coroutine.lua | |
| parent | 3f253f116e8e292977a1bded964544fb35b3d1e3 (diff) | |
| download | lua-d881325c2fcbb6d2c434ec403b0bbe51ac200c7b.tar.gz lua-d881325c2fcbb6d2c434ec403b0bbe51ac200c7b.tar.bz2 lua-d881325c2fcbb6d2c434ec403b0bbe51ac200c7b.zip | |
Flag for to-be-closed variables changed to '<toclose>'
The flag for to-be-closed variables was changed from '*toclose'
to '<toclose>'. Several people found confusing the old syntax and
the new one has a clear terminator, making it more flexible for
future changes.
Diffstat (limited to 'testes/coroutine.lua')
| -rw-r--r-- | testes/coroutine.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/testes/coroutine.lua b/testes/coroutine.lua index 9dd501e7..db6d074e 100644 --- a/testes/coroutine.lua +++ b/testes/coroutine.lua | |||
| @@ -151,7 +151,7 @@ do | |||
| 151 | end | 151 | end |
| 152 | 152 | ||
| 153 | co = coroutine.create(function () | 153 | co = coroutine.create(function () |
| 154 | local *toclose x = func2close(function (self, err) | 154 | local <toclose> x = func2close(function (self, err) |
| 155 | assert(err == nil); X = false | 155 | assert(err == nil); X = false |
| 156 | end) | 156 | end) |
| 157 | X = true | 157 | X = true |
| @@ -164,7 +164,7 @@ do | |||
| 164 | 164 | ||
| 165 | -- error killing a coroutine | 165 | -- error killing a coroutine |
| 166 | co = coroutine.create(function() | 166 | co = coroutine.create(function() |
| 167 | local *toclose x = func2close(function (self, err) | 167 | local <toclose> x = func2close(function (self, err) |
| 168 | assert(err == nil); error(111) | 168 | assert(err == nil); error(111) |
| 169 | end) | 169 | end) |
| 170 | coroutine.yield() | 170 | coroutine.yield() |
| @@ -348,7 +348,7 @@ do | |||
| 348 | 348 | ||
| 349 | local X = false | 349 | local X = false |
| 350 | A = coroutine.wrap(function() | 350 | A = coroutine.wrap(function() |
| 351 | local *toclose _ = setmetatable({}, {__close = function () X = true end}) | 351 | local <toclose> _ = setmetatable({}, {__close = function () X = true end}) |
| 352 | return pcall(A, 1) | 352 | return pcall(A, 1) |
| 353 | end) | 353 | end) |
| 354 | st, res = A() | 354 | st, res = A() |
