Skip to main content

PackTable

This function was added in DSL 4

Description

Serialize the table into a single string that can be unpacked using UnpackTable. This is a lower level version of the PackData function.

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 PackTable(tbl) --[[ ... ]] end

Parameters

  • tbl: table - The table to serialize. It can contain nested tables, but circular references are not allowed.

Return Values

  • serializedTable: string - The serialized string representation of the table.

Versions

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

Example

local myTable = {
name = 'Example',
value = 42,
nested = { key = 'value' },
flag = true,
}
local serialized = PackTable(myTable)
print('Serialized Table: ' .. serialized)