diff options
Diffstat (limited to 'meta/3rd/love2d/library/love/data.lua')
m--------- | meta/3rd/love2d | 0 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love/data.lua | 264 |
2 files changed, 0 insertions, 264 deletions
diff --git a/meta/3rd/love2d b/meta/3rd/love2d new file mode 160000 +Subproject dad72a7eae31f35bf4c6529e5b81f6187b5b737 diff --git a/meta/3rd/love2d/library/love/data.lua b/meta/3rd/love2d/library/love/data.lua deleted file mode 100644 index 55116570..00000000 --- a/meta/3rd/love2d/library/love/data.lua +++ /dev/null @@ -1,264 +0,0 @@ ----@meta - ---- ----Provides functionality for creating and transforming data. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data) ---- ----@class love.data -love.data = {} - ---- ----Compresses a string or data using a specific compression algorithm. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.compress) ---- ----@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, data: love.Data, level?: number):love.CompressedData|string ----@param container love.ContainerType # What type to return the compressed data as. ----@param format love.CompressedDataFormat # The format to use when compressing the string. ----@param rawstring string # The raw (un-compressed) string to compress. ----@param level? number # 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. ----@return love.CompressedData|string compressedData # CompressedData/string which contains the compressed version of rawstring. -function love.data.compress(container, format, rawstring, level) end - ---- ----Decode Data or a string from any of the EncodeFormats to Data or string. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.decode) ---- ----@overload fun(container: love.ContainerType, format: love.EncodeFormat, sourceData: love.Data):love.ByteData|string ----@param container love.ContainerType # What type to return the decoded data as. ----@param format love.EncodeFormat # The format of the input data. ----@param sourceString string # The raw (encoded) data to decode. ----@return love.ByteData|string decoded # ByteData/string which contains the decoded version of source. -function love.data.decode(container, format, sourceString) end - ---- ----Decompresses a CompressedData or previously compressed string or Data object. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.decompress) ---- ----@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, compressedString: string):love.Data|string ----@overload fun(container: love.ContainerType, format: love.CompressedDataFormat, data: love.Data):love.Data|string ----@param container love.ContainerType # What type to return the decompressed data as. ----@param compressedData love.CompressedData # The compressed data to decompress. ----@return love.Data|string decompressedData # Data/string containing the raw decompressed data. -function love.data.decompress(container, compressedData) end - ---- ----Encode Data or a string to a Data or string in one of the EncodeFormats. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.encode) ---- ----@overload fun(container: love.ContainerType, format: love.EncodeFormat, sourceData: love.Data, linelength?: number):love.ByteData|string ----@param container love.ContainerType # What type to return the encoded data as. ----@param format love.EncodeFormat # The format of the output data. ----@param sourceString string # The raw data to encode. ----@param linelength? number # The maximum line length of the output. Only supported for base64, ignored if 0. ----@return love.ByteData|string encoded # ByteData/string which contains the encoded version of source. -function love.data.encode(container, format, sourceString, linelength) end - ---- ----Gets the size in bytes that a given format used with love.data.pack will use. ---- ----This function behaves the same as Lua 5.3's string.packsize. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.getPackedSize) ---- ----@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings. ----@return number size # The size in bytes that the packed data will use. -function love.data.getPackedSize(format) end - ---- ----Compute the message digest of a string using a specified hash algorithm. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.hash) ---- ----@overload fun(hashFunction: love.HashFunction, data: love.Data):string ----@param hashFunction love.HashFunction # Hash algorithm to use. ----@param string string # String to hash. ----@return string rawdigest # Raw message digest string. -function love.data.hash(hashFunction, string) end - ---- ----Creates a new Data object containing arbitrary bytes. ---- ----Data:getPointer along with LuaJIT's FFI can be used to manipulate the contents of the ByteData object after it has been created. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.newByteData) ---- ----@overload fun(Data: love.Data, offset?: number, size?: number):love.ByteData ----@overload fun(size: number):love.ByteData ----@param datastring string # The byte string to copy. ----@return love.ByteData bytedata # The new Data object. -function love.data.newByteData(datastring) end - ---- ----Creates a new Data referencing a subsection of an existing Data object. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.newDataView) ---- ----@param data love.Data # The Data object to reference. ----@param offset number # The offset of the subsection to reference, in bytes. ----@param size number # The size in bytes of the subsection to reference. ----@return love.Data view # The new Data view. -function love.data.newDataView(data, offset, size) end - ---- ----Packs (serializes) simple Lua values. ---- ----This function behaves the same as Lua 5.3's string.pack. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.pack) ---- ----@param container love.ContainerType # What type to return the encoded data as. ----@param format string # A string determining how the values are packed. Follows the rules of Lua 5.3's string.pack format strings. ----@param v1 number|boolean|string # The first value (number, boolean, or string) to serialize. ----@vararg number|boolean|string # Additional values to serialize. ----@return love.Data|string data # Data/string which contains the serialized data. -function love.data.pack(container, format, v1, ...) end - ---- ----Unpacks (deserializes) a byte-string or Data into simple Lua values. ---- ----This function behaves the same as Lua 5.3's string.unpack. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data.unpack) ---- ----@overload fun(format: string, data: love.Data, pos?: number):number|boolean|string, number|boolean|string, number ----@param format string # A string determining how the values were packed. Follows the rules of Lua 5.3's string.pack format strings. ----@param datastring string # A string containing the packed (serialized) data. ----@param pos? number # Where to start reading in the string. Negative values can be used to read relative from the end of the string. ----@return number|boolean|string v1 # The first value (number, boolean, or string) that was unpacked. ----@return number index # The index of the first unread byte in the data string. -function love.data.unpack(format, datastring, pos) end - ---- ----Data object containing arbitrary bytes in an contiguous memory. ---- ----There are currently no LÖVE functions provided for manipulating the contents of a ByteData, but Data:getPointer can be used with LuaJIT's FFI to access and write to the contents directly. ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data) ---- ----@class love.ByteData: love.Object, love.Data -local ByteData = {} - ---- ----Represents byte data compressed using a specific algorithm. ---- ----love.data.decompress can be used to de-compress the data (or love.math.decompress in 0.10.2 or earlier). ---- ---- ----[Open in Browser](https://love2d.org/wiki/love.data) ---- ----@class love.CompressedData: love.Data, love.Object -local CompressedData = {} - ---- ----Gets the compression format of the CompressedData. ---- ---- ----[Open in Browser](https://love2d.org/wiki/CompressedData:getFormat) ---- ----@return love.CompressedDataFormat format # The format of the CompressedData. -function CompressedData:getFormat() end - ---- ----Compressed data formats. ---- ---- ----[Open in Browser](https://love2d.org/wiki/CompressedDataFormat) ---- ----@alias love.CompressedDataFormat ---- ----The LZ4 compression format. Compresses and decompresses very quickly, but the compression ratio is not the best. LZ4-HC is used when compression level 9 is specified. Some benchmarks are available here. ---- ----| "lz4" ---- ----The zlib format is DEFLATE-compressed data with a small bit of header data. Compresses relatively slowly and decompresses moderately quickly, and has a decent compression ratio. ---- ----| "zlib" ---- ----The gzip format is DEFLATE-compressed data with a slightly larger header than zlib. Since it uses DEFLATE it has the same compression characteristics as the zlib format. ---- ----| "gzip" ---- ----Raw DEFLATE-compressed data (no header). ---- ----| "deflate" - ---- ----Return type of various data-returning functions. ---- ---- ----[Open in Browser](https://love2d.org/wiki/ContainerType) ---- ----@alias love.ContainerType ---- ----Return type is ByteData. ---- ----| "data" ---- ----Return type is string. ---- ----| "string" - ---- ----Encoding format used to encode or decode data. ---- ---- ----[Open in Browser](https://love2d.org/wiki/EncodeFormat) ---- ----@alias love.EncodeFormat ---- ----Encode/decode data as base64 binary-to-text encoding. ---- ----| "base64" ---- ----Encode/decode data as hexadecimal string. ---- ----| "hex" - ---- ----Hash algorithm of love.data.hash. ---- ---- ----[Open in Browser](https://love2d.org/wiki/HashFunction) ---- ----@alias love.HashFunction ---- ----MD5 hash algorithm (16 bytes). ---- ----| "md5" ---- ----SHA1 hash algorithm (20 bytes). ---- ----| "sha1" ---- ----SHA2 hash algorithm with message digest size of 224 bits (28 bytes). ---- ----| "sha224" ---- ----SHA2 hash algorithm with message digest size of 256 bits (32 bytes). ---- ----| "sha256" ---- ----SHA2 hash algorithm with message digest size of 384 bits (48 bytes). ---- ----| "sha384" ---- ----SHA2 hash algorithm with message digest size of 512 bits (64 bytes). ---- ----| "sha512" |