Difference between revisions of "love.data.compress"
(Need to read LOVE source code to get the argument order. Please edit if it's incorrect.) |
m (Added ContainerType param) |
||
Line 1: | Line 1: | ||
− | {{newin|[[0.11.0]]|110|type=function|text= | + | {{newin|[[0.11.0]]|110|type=function|text=Deprecates [[love.math.compress]]}} |
Compresses a string or data using a specific compression algorithm. | Compresses a string or data using a specific compression algorithm. | ||
{{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].}} | {{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].}} | ||
+ | {{notice|This is unofficial documentation. This might be not accurate!}} | ||
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | compressedData = love.data.compress( format, rawstring, level ) | + | compressedData = love.data.compress( container, format, rawstring, level ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
+ | {{param|ContainerType|container|What type to return the compressed data as.}} | ||
{{param|CompressedDataFormat|format|The format to use when compressing the string.}} | {{param|CompressedDataFormat|format|The format to use when compressing the string.}} | ||
{{param|string|rawstring|The raw (un-compressed) string to compress.}} | {{param|string|rawstring|The raw (un-compressed) string to compress.}} | ||
{{param|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.}} | {{param|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 === | === Returns === | ||
− | {{param|CompressedData|compressedData| | + | {{param|CompressedData or string|compressedData|[[CompressedData]]/[[string]] which contains the compressed version of rawstring.}} |
== Function == | == Function == | ||
=== Synopsis === | === Synopsis === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | compressedData = love.data.compress( format, data, level ) | + | compressedData = love.data.compress( container, format, data, level ) |
</source> | </source> | ||
=== Arguments === | === Arguments === | ||
+ | {{param|ContainerType|container|What type to return the compressed data as.}} | ||
{{param|CompressedDataFormat|format|The format to use when compressing the data.}} | {{param|CompressedDataFormat|format|The format to use when compressing the data.}} | ||
{{param|Data|data|A Data object containing the raw (un-compressed) data to compress.}} | {{param|Data|data|A Data object containing the raw (un-compressed) data to compress.}} | ||
{{param|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.}} | {{param|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 === | === Returns === | ||
− | {{param|CompressedData|compressedData| | + | {{param|CompressedData or string|compressedData|[[CompressedData]]/[[string]] which contains the compressed version of data.}} |
== See Also == | == See Also == | ||
* [[parent::love.data]] | * [[parent::love.data]] |
Revision as of 12:38, 7 January 2018
Available since LÖVE 0.11.0 |
Deprecates love.math.compress. |
Compresses a string or data using a specific compression algorithm.
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. |
This is unofficial documentation. This might be not accurate! |
Contents
Function
Synopsis
compressedData = love.data.compress( container, format, rawstring, level )
Arguments
ContainerType container
- What type to return the compressed data as.
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 or string compressedData
- CompressedData/string which contains the compressed version of rawstring.
Function
Synopsis
compressedData = love.data.compress( container, format, data, level )
Arguments
ContainerType container
- What type to return the compressed data as.
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 or string compressedData
- CompressedData/string which contains the compressed version of data.
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info