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.
This commit is contained in:
@@ -151,7 +151,7 @@ do
|
||||
end
|
||||
|
||||
co = coroutine.create(function ()
|
||||
local *toclose x = func2close(function (self, err)
|
||||
local <toclose> x = func2close(function (self, err)
|
||||
assert(err == nil); X = false
|
||||
end)
|
||||
X = true
|
||||
@@ -164,7 +164,7 @@ do
|
||||
|
||||
-- error killing a coroutine
|
||||
co = coroutine.create(function()
|
||||
local *toclose x = func2close(function (self, err)
|
||||
local <toclose> x = func2close(function (self, err)
|
||||
assert(err == nil); error(111)
|
||||
end)
|
||||
coroutine.yield()
|
||||
@@ -348,7 +348,7 @@ do
|
||||
|
||||
local X = false
|
||||
A = coroutine.wrap(function()
|
||||
local *toclose _ = setmetatable({}, {__close = function () X = true end})
|
||||
local <toclose> _ = setmetatable({}, {__close = function () X = true end})
|
||||
return pcall(A, 1)
|
||||
end)
|
||||
st, res = A()
|
||||
|
||||
Reference in New Issue
Block a user