string/table扩展模块新增几个方法用于数据打包/解包
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
local scene={}
|
||||
|
||||
local function dumpCB(T)
|
||||
love.system.setClipboardText(
|
||||
love.data.encode(
|
||||
'string','base64',
|
||||
love.data.compress(
|
||||
'string','zlib',
|
||||
TABLE.dump(T)
|
||||
)
|
||||
)
|
||||
)
|
||||
love.system.setClipboardText(STRING.packText(TABLE.dump(T)))
|
||||
LOG.print(text.exportSuccess,'message')
|
||||
end
|
||||
local function parseCB()
|
||||
@@ -17,10 +9,8 @@ local function parseCB()
|
||||
local s=love.system.getClipboardText()
|
||||
|
||||
--Decode
|
||||
_,s=pcall(love.data.decode,'string','base64',s)
|
||||
if not _ then LOG.print(text.dataCorrupted,'error')return end
|
||||
_,s=pcall(love.data.decompress,'string','zlib',s)
|
||||
if not _ then LOG.print(text.dataCorrupted,'error')return end
|
||||
s=STRING.unpackText(s)
|
||||
if not s then LOG.print(text.dataCorrupted,'error')return end
|
||||
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
|
||||
Reference in New Issue
Block a user