json库使用方式调整

This commit is contained in:
MrZ626
2020-12-14 18:34:35 +08:00
parent f17724c7ef
commit 2381dca463
6 changed files with 69 additions and 90 deletions

View File

@@ -304,7 +304,12 @@ do--json
function json.encode(val)
local a,b=pcall(encode,val)
if a then return b else return""end
if a then
return b
else
LOG.print(text.jsonError,"warn")
return
end
end
-------------------------------------------------------------------------------
@@ -532,7 +537,12 @@ do--json
end
function json.decode(str)
local a,b=pcall(decode,str)
if a then return b else return""end
if a then
return b
else
LOG.print(text.jsonError,"warn")
return
end
end
end