云存档功能完成,暂时只能通过控制台使用

This commit is contained in:
MrZ626
2021-06-06 22:32:13 +08:00
parent 2e5f943b79
commit d3170ab219
4 changed files with 128 additions and 16 deletions

View File

@@ -84,9 +84,6 @@ end
function STRING.packBin(s)
return data.encode('string','base64',data.compress('string','zlib',s))
end
function STRING.packText(s)
return data.encode('string','base64',data.compress('string','gzip',s))
end
function STRING.unpackBin(str)
local res
res,str=pcall(data.decode,'string','base64',str)
@@ -94,6 +91,9 @@ function STRING.unpackBin(str)
res,str=pcall(data.decompress,'string','zlib',str)
if res then return str end
end
function STRING.packText(s)
return data.encode('string','base64',data.compress('string','gzip',s))
end
function STRING.unpackText(str)
local res
res,str=pcall(data.decode,'string','base64',str)
@@ -101,5 +101,11 @@ function STRING.unpackText(str)
res,str=pcall(data.decompress,'string','gzip',str)
if res then return str end
end
function STRING.packTable(t)
return STRING.packText(JSON.encode(t))
end
function STRING.unpackTable(t)
return JSON.decode(STRING.unpackText(t))
end
return STRING