优化FILE.save和dumpTable
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user