脚本写如果ailua文件存在不进行操作如果不存在拷贝到上级目录
-- 获取当前脚本所在路径 local scriptPath = debug.getinfo(1).source:match("@?(./)") -- 拼接文件路径 local filePath = scriptPath .. "ai.lua" -- 检查文件是否存在 local file = io.open(filePath, "r") if file then -- 如果文件存在,关闭文件 file:close() else -- 如果文件不存在,拷贝到上级目录 local parentPath = scriptPath:match("(.[/\])") os.execute("cp " .. filePath .. " " .. parentPath) end
原文地址: https://www.cveoy.top/t/topic/egWD 著作权归作者所有。请勿转载和采集!