ReferenceEncoding and crypto

lz4decompress

Decompresses LZ4 data into a byte string.

Syntax

lz4decompress(data: string, size: number?) -> string

Also available as

crypt.lz4decompresslz4_decompress

Parameters

ParameterTypeDescription
datastringCompressed bytes.
sizenumber?Expected output size or output bound.

Returns

TypeDescription
stringDecompressed bytes.

Description

An explicit size bounds the output and is required by some other executors. Apex also supports automatic size handling for its supported representation. Malformed input or a size smaller than the required result raises an error; do not use a value received from an untrusted source without checking it.

Example

local original = "hello"
assert(lz4decompress(lz4compress(original), #original) == original)

These are Game executor contracts. Check build requirements and session lifetimes before using them.