A package for compressing/decompressing data with support for DataStore.
export type SupportedType = nil
| boolean
| number
| string
| { [SupportedType]: SupportedType }
| BrickColor
| Color3
| CFrame
| Vector3
| Vector2
| UDim2
| UDim
| Ray
| Rect
| Region3
| Enum
| NumberRange
| NumberSequence
| ColorSequence
In this example, you can learn how to save a player data in the DataStore
local DataSerializer = require(DataSerializer)
local playerData = {
Admin = true,
Values = {
Coins = 2000000,
Diamonds = 7000,
Skills = {
"Thorns",
"Flying",
"X-Ray"
}
}
}
-- Returns an array of strings, that you can save in DataStore
-- to deserialize later
local encoded = DataSerializer.Serialize(playerData)
DataStore:SetAsync("Player_1", encoded)
local DataSerializer = require(DataSerializer)
local encoded = DataStore:GetAsync("Player_1")
local playerData = DataSerializer.Deserialize(encoded)
SupportedType
input**, number?
zlibLevel, boolean?
useBase64 ) → {string}
outputzlibLevel is the level of compression. The higher the lightest, but slowest. Use 0 for disabling, 9 for max compression. Defaults to 6.
useBase64 is whether the data will be encoded into valid characters or not. Base64 makes the result ~33% heavier. Enable it if you are storing the output in a DataStore, as it only accepts valid characters. Defaults to true.
{string}
input**, boolean?
usesBase64 ) → {string}
outputDeserializes the previously serialized data