diff --git a/Zframework/file.lua b/Zframework/file.lua index c574c30e..2327d075 100644 --- a/Zframework/file.lua +++ b/Zframework/file.lua @@ -13,6 +13,7 @@ function FILE.load(name) return s() else LOG.print(name.." "..text.loadError,COLOR.red) + return{} end else local res=json.decode(s) @@ -20,6 +21,7 @@ function FILE.load(name) return res else LOG.print(name.." "..text.loadError,COLOR.red) + return{} end end end @@ -27,11 +29,10 @@ end function FILE.save(data,name,mode,luacode) if not mode then mode="m"end name=name..".dat" - local _,mes if not luacode then - res=json.encode(res) - if res then - LOG.print(name.." "..text.saveError..(mes or"json error"),"error") + data=json.encode(data) + if not data then + LOG.print(name.." "..text.saveError.."json error","error") end else data=dumpTable(data) @@ -39,7 +40,7 @@ function FILE.save(data,name,mode,luacode) local F=fs.newFile(name) F:open("w") - _,mes=F:write(data) + local _,mes=F:write(data) F:flush()F:close() if _ then if mode:find("m")then diff --git a/Zframework/toolfunc.lua b/Zframework/toolfunc.lua index 677d36e3..f47b94be 100644 --- a/Zframework/toolfunc.lua +++ b/Zframework/toolfunc.lua @@ -307,7 +307,7 @@ do--json if a then return b else - LOG.print(text.jsonError,"warn") + LOG.print(text.jsonError..": "..(b or"uknErr"),"warn") return end end @@ -540,7 +540,7 @@ do--json if a then return b else - LOG.print(text.jsonError,"warn") + LOG.print(text.jsonError..": "..(b or"uknErr"),"warn") return end end