读取字符串存为数组保存到指定目录文本

[复制链接]
查看1187 | 回复0 | 2023-4-21 05:21:57 | 显示全部楼层 |阅读模式

function 读取字符串存为数组(路径)
        if fileExist(存储路径)==false then
                local file = io.open(存储路径, "w")--w创建文件
                file:close()--w关闭文件
        end
        t={}
        io.input(存储路径)
        while true do
                local ReadContent = io.read()
                if ReadContent == null then
                        break
                else
                end
                table.insert(t,ReadContent)
        end
        if t[1]==nil then
                io.close()
                return nil
        else
                io.close()
                return t
        end
end

有问题?
找老发呀!!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

7

主题

22

帖子

100

积分

注册会员

Rank: 2

积分
100
QQ