Difference between revisions of "love.math.compress"

m
Line 1: Line 1:
 
{{newin|[[0.10.0]]|100|type=function}}
 
{{newin|[[0.10.0]]|100|type=function}}
 
Compresses a string or data using a specific compression algorithm.
 
Compresses a string or data using a specific compression algorithm.
{{newobjectnotice}}
+
{{notice|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 [https://github.com/Cyan4973/lz4#user-content-benchmarks here].}}
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===

Revision as of 02:01, 31 March 2016

Available since LÖVE 0.10.0
This function is not supported in earlier versions.

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.math.compress( rawstring, format, level )

Arguments

string rawstring
The raw (un-compressed) string to compress.
CompressedDataFormat format ("lz4")
The format to use when compressing the string.
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.math.compress( data, format, level )

Arguments

Data data
A Data object containing the raw (un-compressed) data to compress.
CompressedDataFormat format ("lz4")
The format to use when compressing the data.
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