发表时间:2026-07-06 11:37:30作者:zhao人气:更新时间:2026-09-09 19:12:22
获得文件长度
function length_of_file(filename)
local fh = assert(io.open(filename, "rb"))
local len = assert(fh:seek("end"))
fh:close()
return len
end
判断文件是否存在
function file_exists(path)
local file = io.open(path, "rb")
if file then file:close() end
return file ~= nil
end
网友评论