0.2.0-dev Download ZIP
41 lines ·1.4 KB Raw
| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="PackedDataContainerRef" inherits="RefCounted" api_type="core" deprecated="Use [method @GlobalScope.var_to_bytes] or [method FileAccess.store_var] instead. To enable data compression, use [method PackedByteArray.compress] or [method FileAccess.open_compressed]." xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | An internal class used by [PackedDataContainer] to pack nested arrays and dictionaries. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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]. |
| 8 | [codeblock] |
| 9 | var packed = PackedDataContainer.new() |
| 10 | packed.pack([1, 2, 3, ["nested1", "nested2"], 4, 5, 6]) |
| 11 | |
| 12 | for element in packed: |
| 13 | if element is PackedDataContainerRef: |
| 14 | for subelement in element: |
| 15 | print("::", subelement) |
| 16 | else: |
| 17 | print(element) |
| 18 | [/codeblock] |
| 19 | Prints: |
| 20 | [codeblock lang=text] |
| 21 | 1 |
| 22 | 2 |
| 23 | 3 |
| 24 | ::nested1 |
| 25 | ::nested2 |
| 26 | 4 |
| 27 | 5 |
| 28 | 6 |
| 29 | [/codeblock] |
| 30 | </description> |
| 31 | <tutorials> |
| 32 | </tutorials> |
| 33 | <methods> |
| 34 | <method name="size" qualifiers="const"> |
| 35 | <return type="int" /> |
| 36 | <description> |
| 37 | Returns the size of the packed container (see [method Array.size] and [method Dictionary.size]). |
| 38 | </description> |
| 39 | </method> |
| 40 | </methods> |
| 41 | </class> |