优化FILE.save和dumpTable

This commit is contained in:
MrZ626
2020-11-29 20:59:14 +08:00
parent 2c247a599d
commit ca8dde28bf
2 changed files with 10 additions and 2 deletions

View File

@@ -33,16 +33,21 @@ function FILE.save(data,name,mode,luacode)
data=json.encode(data)
if not data then
LOG.print(name.." "..text.saveError.."json error","error")
return
end
else
data=dumpTable(data)
if not data then
LOG.print(name.." "..text.saveError.."dump error","error")
return
end
end
local F=fs.newFile(name)
F:open("w")
local _,mes=F:write(data)
local success,mes=F:write(data)
F:flush()F:close()
if _ then
if success then
if mode:find("m")then
LOG.print(text.saveDone,COLOR.green)
end

View File

@@ -131,6 +131,9 @@ do--dumpTable
else
s="return{\n"
t=1
if type(L)~="table"then
return
end
end
local count=1
for k,v in next,L do