1.代码
local status, calParaFun = pcall(require, calParaFileName)
if not status then -- 如果模块加载失败则创建脚本文件
local file = io.open(calParaFileName..".lua", "w")
if file then
file:write("-- 计算参数:"..name.."\n"..
"local ModuleInputParas = require('InputPara/InputParas')\n"..
"local ModulePublicParas = require('PublicPara/PublicParas')\n"..
"local function exec()\n"..
" return nil\n"..
"end\n"..
"return exec\n"
)
file:close()
else
print("无法创建公共参数拟合算法文件")
end
else -- 如果模块加载成功则执行需要的操作
print("old", name, publicParas[name])
end