-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathtest.lua
More file actions
41 lines (28 loc) · 666 Bytes
/
test.lua
File metadata and controls
41 lines (28 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
s = require "serialize"
b = s.pack{[10] = {1,2}}
s.dump(b)
bb = s.unpack(b)
for k,v in pairs(bb[10]) do
print(k,v)
end
--[[
a = s.pack { hello={3,4}, false, 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9 }
s.dump(a)
a = s.append(a, 42,4.2,-1,1000,80000,"hello",true,false,nil,"1234567890123456789012345678901234567890")
s.dump(a)
print(a)
function pr(t,...)
for k,v in pairs(t) do
print(k,v)
end
print(...)
end
print ("------")
local seri, length = s.serialize(a)
print(seri, length)
pr(s.unpack(a))
print("-------")
pr(s.deserialize(seri))
]]
a = s.serialize_string( 1,2,3,4,5 )
print(#a, s.deseristring_string(a))