Skip to main content

PackData

This function was added in DSL 1

Description

Serialize all of the values given into a single string that can be unpacked using UnpackData.

If you only want to pack a single table, consider using PackTable.

Only the following values are allowed to be serialized: boolean, number, string, table, and light userdata. Do not use any tables that refer back to themselves.

function PackData(...) --[[ ... ]] end

Parameters

  • ...: boolean|number|string|table|light userdata - The values to serialize. You can pass any number of values, and they can be of any of the allowed types.

Return Values

  • serializedData: string - The serialized string containing all the packed values.

Versions

  • DSL 7 - light userdata is supported, which lets you serialize hashes returned by ObjectNameToHashID.

Example

local packedData = PackData(true, 123, 'Hello', { key = 'value' }, lightUserData)
print('Packed Data: ' .. packedData)