From 7baf0a38ca7ed07784ad3e08e8e85b66de05eae6 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Mon, 24 Aug 2015 01:39:46 +0200 Subject: Make '*' optional for file:lines() and file:read(). --- tests/test.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test.lua b/tests/test.lua index c634ebe..0c77240 100755 --- a/tests/test.lua +++ b/tests/test.lua @@ -541,10 +541,18 @@ ___'' do writefile("data.txt", "123 18.8 hello world\ni'm here\n") io.input("data.txt") - print(io.read("*n", "*number", "*l", "*a")) + print("io.read()", io.read("*n", "*number", "*l", "*a")) io.input("data.txt") - print(io.read("n", "number", "l", "a")) + print("io.read()", io.read("n", "number", "l", "a")) io.input(io.stdin) + if mode ~= "module" then + local f = assert(io.open("data.txt", "r")) + print("file:read()", f:read("*n", "*number", "*l", "*a")) + f:close() + f = assert(io.open("data.txt", "r")) + print("file:read()", f:read("n", "number", "l", "a")) + f:close() + end os.remove("data.txt") end @@ -580,7 +588,7 @@ do end f:close() f = assert(io.open("data.txt", "r")) - for n1,n2,rest in f:lines("*n", "*n", "*a") do + for n1,n2,rest in f:lines("*n", "n", "*a") do print("file:lines()", n1, n2, rest) end f:close() -- cgit v1.2.3-55-g6feb