mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
84 lines
3.4 KiB
ReStructuredText
84 lines
3.4 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_PackedDataContainerRef:
|
|
|
|
PackedDataContainerRef
|
|
======================
|
|
|
|
**Deprecato:** Use :ref:`@GlobalScope.var_to_bytes()<class_@GlobalScope_method_var_to_bytes>` or :ref:`FileAccess.store_var()<class_FileAccess_method_store_var>` instead. To enable data compression, use :ref:`PackedByteArray.compress()<class_PackedByteArray_method_compress>` or :ref:`FileAccess.open_compressed()<class_FileAccess_method_open_compressed>`.
|
|
|
|
**Eredita:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Una classe interna utilizzata da :ref:`PackedDataContainer<class_PackedDataContainer>` per impacchettare array e dizionari annidati.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Descrizione
|
|
----------------------
|
|
|
|
Quando si impacchettano contenitori innestati tramite un :ref:`PackedDataContainer<class_PackedDataContainer>`, sono impacchettati ricorsivamente in un **PackedDataContainerRef** (si applica solo a :ref:`Array<class_Array>` e :ref:`Dictionary<class_Dictionary>`). I loro dati possono essere recuperati nello stesso modo di :ref:`PackedDataContainer<class_PackedDataContainer>`.
|
|
|
|
::
|
|
|
|
var packed = PackedDataContainer.new()
|
|
packed.pack([1, 2, 3, ["nested1", "nested2"], 4, 5, 6])
|
|
|
|
for element in packed:
|
|
if element is PackedDataContainerRef:
|
|
for subelement in element:
|
|
print("::", subelement)
|
|
else:
|
|
print(element)
|
|
|
|
Stampa:
|
|
|
|
.. code:: text
|
|
|
|
1
|
|
2
|
|
3
|
|
::nested1
|
|
::nested2
|
|
4
|
|
5
|
|
6
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Metodi
|
|
------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-----------------------+---------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`size<class_PackedDataContainerRef_method_size>`\ (\ ) |const| |
|
|
+-----------------------+---------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni dei metodi
|
|
--------------------------------------------
|
|
|
|
.. _class_PackedDataContainerRef_method_size:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`int<class_int>` **size**\ (\ ) |const| :ref:`🔗<class_PackedDataContainerRef_method_size>`
|
|
|
|
Restituisce la dimensione del contenitore compresso (vedi :ref:`Array.size()<class_Array_method_size>` e :ref:`Dictionary.size()<class_Dictionary_method_size>`).
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
|
|
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
|
|
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
|
|
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
|
|
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
|
|
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`
|