Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
PackedDataContainerRef¶
继承: RefCounted < Object
PackedDataContainer 使用的内部类,用于打包嵌套的数组和字典。
描述¶
使用 PackedDataContainer 打包嵌套容器时,会将其递归打包进 PackedDataContainerRef(仅适用于 Array 和 Dictionary)。获取数据的方法和 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)
# 输出:
# 1
# 2
# 3
# ::abc
# ::def
# 4
# 5
# 6
方法¶
size ( ) const |
方法说明¶
int size ( ) const
返回打包后容器的大小(见 Array.size 和 Dictionary.size)。