love.data.compress

Available since LÖVE 0.11.0
It has replaced love.math.compress.

Compresses a string or data using a specific compression algorithm.

O.png This function, depending on the compression format and level, can be slow if called repeatedly, such as from love.update or love.draw. Some benchmarks are available here.  


Function

Synopsis

compressedData = love.data.compress( format, rawstring, level )

Arguments

CompressedDataFormat format
The format to use when compressing the string.
string rawstring
The raw (un-compressed) string to compress.
number level (-1)
The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used.

Returns

CompressedData compressedData
A new Data object containing the compressed version of the string.

Function

Synopsis

compressedData = love.data.compress( format, data, level )

Arguments

CompressedDataFormat format
The format to use when compressing the data.
Data data
A Data object containing the raw (un-compressed) data to compress.
number level (-1)
The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used.

Returns

CompressedData compressedData
A new Data object containing the compressed version of the raw data.

See Also

Other Languages