1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +00:00

Moved lzlib to the libs directory (cleaner)

This commit is contained in:
Reuh 2015-10-04 12:08:25 +02:00
parent 406e17d321
commit 4aad32d5ab
23 changed files with 2593 additions and 991 deletions

29
libs/lzlib/test_zlib3.lua Normal file
View file

@ -0,0 +1,29 @@
local zlib = require"zlib"
local dataToDeflate = {}
print("Generating test data...")
for i = 0, 10000 do
table.insert(dataToDeflate, string.sub(tostring(math.random()), 3))
end
dataToDeflate = table.concat(dataToDeflate)
print("Length of data to deflate", #dataToDeflate)
local buffer = {}
local func = function(data)
table.insert(buffer, data)
end
stream = zlib.deflate(func) --best compression, deflated
stream:write(dataToDeflate)
--stream:flush("sync")
--stream:flush()
stream:close()
--local deflatedData = string.sub(table.concat(buffer), 3) -- needed for IE
local deflatedData = table.concat(buffer)
print(#deflatedData)
streamIn = zlib.inflate(deflatedData)
local inflatedData = streamIn:read()
assert(dataToDeflate == inflatedData)