Jump to content
Sign in to follow this  
Shino

[Library] LibCompress

Recommended Posts

Hey!

I backported the LibCompress Library of retail.

My initial goal was to use it in order to speed up the loading time for login and logout, but it failed.

But maybe it can be used for AddonMessages in order to decrease traffic.

Now lazy readme copy paste:

I added a few methods:

LibCompress:TableToString(t)

LibCompress:StringToTable(t)

LibCompress:StringSplit(del, table) -- Will return a table

The LZW compression is not working, and I can't figure really out why. The Huffman compression is working fine.

Usage: local libc = LibStub:GetLibrary("LibCompress")

local uncompressed = "Hey! I'd like to be compressed"
local compressed = libc:CompressHuffman(uncompressed)
uncompressed = libc:DecompressHuffman(compressed)

local table = {
[1] => {
["test"] => 123
},
[2] => 3
}

local uncompressed = libc:TableToString(table)

Returns "1>{,test>123,},2>3,"

 

You can download it here.

cheers!

 

Share this post


Link to post
Share on other sites

Damn man, you are 1337. Back-porting all these libraries is super useful for the vanilla community! Great work!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×