云存档功能完成,暂时只能通过控制台使用
This commit is contained in:
@@ -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
|
||||
@@ -1,4 +1,3 @@
|
||||
local data=love.data
|
||||
local next,type=next,type
|
||||
local TABLE={}
|
||||
|
||||
@@ -188,16 +187,4 @@ do--function TABLE.dumpDeflate(L,t)
|
||||
TABLE.dumpDeflate=dump
|
||||
end
|
||||
|
||||
function TABLE.pack(t)
|
||||
return STRING.packText(TABLE.dumpDeflate(t))
|
||||
end
|
||||
|
||||
function TABLE.unpack(s)
|
||||
s=loadstring(STRING.unpackText(s))
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
return s()
|
||||
end
|
||||
end
|
||||
|
||||
return TABLE
|
||||
Reference in New Issue
Block a user