wiremod / wire

Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.
http://www.wiremod.com
Apache License 2.0
551 stars 331 forks source link

Add string compression functions #3020

Closed Denneisk closed 4 months ago

Denneisk commented 5 months ago

Adds compress(string) and decompress(string) functions that use Gmod's built-in compression system. decompress throws on an input string that isn't LZMA compressed. The compression is very fast, with inputs of 64k+ characters barely taking any time, so I think the op counter limit is fine where it is.

I swear I'm going crazy thinking these existed. Maybe it was something else I was testing.

thegrb93 commented 5 months ago

You definitely need to limit input string length because compress is not a linear o(n) algorithm.

Denneisk commented 4 months ago

Was gonna merge these after workshop deploy :P