class_packeddatacontainerref.rst 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/PackedDataContainerRef.xml.
  6. .. _class_PackedDataContainerRef:
  7. PackedDataContainerRef
  8. ======================
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. An internal class used by :ref:`PackedDataContainer<class_PackedDataContainer>` to pack nested arrays and dictionaries.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. When packing nested containers using :ref:`PackedDataContainer<class_PackedDataContainer>`, they are recursively packed into **PackedDataContainerRef** (only applies to :ref:`Array<class_Array>` and :ref:`Dictionary<class_Dictionary>`). Their data can be retrieved the same way as from :ref:`PackedDataContainer<class_PackedDataContainer>`.
  15. ::
  16. var packed = PackedDataContainer.new()
  17. packed.pack([1, 2, 3, ["nested1", "nested2"], 4, 5, 6])
  18. for element in packed:
  19. if element is PackedDataContainerRef:
  20. for subelement in element:
  21. print("::", subelement)
  22. else:
  23. print(element)
  24. Prints:
  25. .. code:: text
  26. 1
  27. 2
  28. 3
  29. ::nested1
  30. ::nested2
  31. 4
  32. 5
  33. 6
  34. .. rst-class:: classref-reftable-group
  35. Methods
  36. -------
  37. .. table::
  38. :widths: auto
  39. +-----------------------+---------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`size<class_PackedDataContainerRef_method_size>`\ (\ ) |const| |
  41. +-----------------------+---------------------------------------------------------------------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Method Descriptions
  46. -------------------
  47. .. _class_PackedDataContainerRef_method_size:
  48. .. rst-class:: classref-method
  49. :ref:`int<class_int>` **size**\ (\ ) |const| :ref:`🔗<class_PackedDataContainerRef_method_size>`
  50. Returns the size of the packed container (see :ref:`Array.size()<class_Array_method_size>` and :ref:`Dictionary.size()<class_Dictionary_method_size>`).
  51. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  52. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  53. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  54. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  55. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  56. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  57. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  58. .. |void| replace:: :abbr:`void (No return value.)`