#LZW Data Compression (fast and pretty good)
1 messages · Page 1 of 1 (latest)
Developer Forum | Roblox
Fixed another edge case. Line 174 is replaced with depth = n == 0 and 1 or math.ceil(math.log(n + 1, 93)). --!native -- Module by 1waffle1 and boatbomber, optimized and fixed by iiau -- https://devforum.roblox.com/t/text-compression/163637/37 local lzw = {} lzw.__index = lzw --local concatSize = 512 lzw.new = function(BUF_SIZE: number?) loc...
Global Framework Interface
--!strict
local Global = require("PathToGlobalFramework")
local httpService = game:GetService("HttpService")
local lzw = require("PathToLZW")
local lzwBuffer = lzw.new()
Global("JsonEncode", function(input: any): string
return httpService:JSONEncode(input)
end :: (input:any) -> string)
Global("JsonDecode", function(value: any): string
return httpService:JSONDecode(value)
end :: (input:string) -> any)
Global("Compress", function(text:string): string
return lzwBuffer:compress(text)
end :: (text:string) -> string)
Global("Decompress", function(compressedText:string): string
return lzwBuffer:decompress(compressedText)
end :: (compressedText:string) -> string)
Global("JsonEncodeAndCompress", function(value:any):string
return lzwBuffer:compress(httpService:JSONEncode(value))
end :: (value:any) -> string)
Global("DecompressAndJsonDecode", function(value:string):string
return httpService:JSONDecode(lzwBuffer:decompress(value))
end :: (value:string) -> any)
I recommend using this for something big, like a map file