– write输出是print简化版输出,不会自动换行,不可以..等复杂操作
io.write(‘okn’)
io.write(string.format(“sin(3) = %.4fn”,math.sin(3)))

– read从当前输入中读取 all line *number

–快速逐行读(按块读)
local file = assert(io.open(“aa.lua”,’r’))
local bufferSize = 2^13 –每行8kb读(最大8kb缓存值)
file:read(bufferSize,”*line”)
file:close()

– 读取文件生成io流进行操作
function write_st( msg )
– body
local file = assert(io.open(“aa.lua”,’a’))
local tmp = io.input()
file:input(“newinput.lua”)
file:write(msg)
io.input():close()
io.input(tmp)
end