Outdated documentation

This documentation page refers to Godot 4.3, and may be outdated or incorrect.
Additionally, this engine version is no longer supported.

Check this page in the stable branch for the latest additions and corrections.

PackedDataContainerRef

Inherits: RefCounted < Object

An internal class used by PackedDataContainer to pack nested arrays and dictionaries.

Description

When packing nested containers using PackedDataContainer, they are recursively packed into PackedDataContainerRef (only applies to Array and Dictionary). Their data can be retrieved the same way as from PackedDataContainer.

var packed = PackedDataContainer.new()
packed.pack([1, 2, 3, ["abc", "def"], 4, 5, 6])

for element in packed:
    if element is PackedDataContainerRef:
        for subelement in element:
            print("::", subelement)
    else:
        print(element)

# Prints:
# 1
# 2
# 3
# ::abc
# ::def
# 4
# 5
# 6

Methods

int

size() const


Method Descriptions

int size() const 🔗

Returns the size of the packed container (see Array.size and Dictionary.size).


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.