Skip to content

Commit

Permalink
Create 封装中控器读写函数.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chudongjingling authored May 22, 2020
1 parent 00da6c9 commit 5301918
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 企业版/封装中控器读写函数.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function writeEEFile(str,path,mode) --写入文件内容,路径,类型,默认路径企业版目录 scriptData/playLog.text 下,自定义路径请把 \ 改为 /。默认类型追加,覆盖第三个参数写 "wb"
mode = mode or "a"
local telib = require("ts_enterprise_lib")
assert(telib,"无法引入企业专用库")
if path==nil then
local ok,msg = telib:controller_injection(
[[
require("lfs").mkdir("scriptData")
local f = io.open("scriptData/playLog.text","a")
if f then
f:write("]]..str..[[\r\n")
f:close()
end
]]
)
else
local ok,msg = telib:controller_injection(
[[
local f = io.open("]]..path..[[","]]..mode..[[")
if f then
f:write("]]..str..[[\r\n")
f:close()
end
]]
)
end
end

0 comments on commit 5301918

Please sign in to comment.