b:read([formats...]) string...
format
调用,即参数列表留空,它会从流中读取下一行,等价于read("*l")
。format
值都会先从IO流中读出,再一次性以多个返回值的形式返回。请注意格式字符串都有 * 前缀,而且只有字符串的第一个字符有意义,其余字符将会被忽略。10
local chars = b:read(10)
local number = b:read("*n")
local line = b:read("*l")
local whole_line = b:read("*L")
local the_whole_file = b:read("*a")
local whole_line = b:read("*L")
- b:getTimeout() number
返回当前带缓冲流设定的超时时间(单位为秒)。默认超时时间为math.huge
。参阅setTimeout
以获取有关于带缓冲流超时时间影响的更多信息。