From b8fed93215a23a3f443c5b0126f0de1725771b44 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 7 Nov 2018 10:03:05 -0200 Subject: New syntax for to-be-closed variables The new syntax is . The mark '*' allows other attributes to be added later without the need of new keywords; it also allows better error messages. The API function was also renamed ('lua_tobeclosed' -> 'lua_toclose'). --- testes/files.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'testes/files.lua') diff --git a/testes/files.lua b/testes/files.lua index a11c5e61..e68eb9b8 100644 --- a/testes/files.lua +++ b/testes/files.lua @@ -125,7 +125,7 @@ do -- closing file by scope local F = nil do - local scoped 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 scoped 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 scoped f = assert(io.open(file, "w")) + local *toclose f = assert(io.open(file, "w")) f:write[[ a line another line -- cgit v1.2.3-55-g6feb