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:
Roberto Ierusalimschy
2019-05-09 12:10:31 -03:00
parent 3f253f116e
commit d881325c2f
8 changed files with 40 additions and 38 deletions

View File

@@ -125,7 +125,7 @@ do
-- closing file by scope
local F = nil
do
local *toclose f = assert(io.open(file, "w"))
local <toclose> f = assert(io.open(file, "w"))
F = f
end
assert(tostring(F) == "file (closed)")
@@ -135,7 +135,7 @@ assert(os.remove(file))
do
-- test writing/reading numbers
local *toclose f = assert(io.open(file, "w"))
local <toclose> f = assert(io.open(file, "w"))
f:write(maxint, '\n')
f:write(string.format("0X%x\n", maxint))
f:write("0xABCp-3", '\n')
@@ -158,7 +158,7 @@ assert(os.remove(file))
-- testing multiple arguments to io.read
do
local *toclose f = assert(io.open(file, "w"))
local <toclose> f = assert(io.open(file, "w"))
f:write[[
a line
another line