mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
Sync classref with 4.5 branch
This commit is contained in:
@@ -12,48 +12,48 @@ Una struttura di dati integrata che contiene una sequenza di elementi.
|
||||
Descrizione
|
||||
----------------------
|
||||
|
||||
An array data structure that can contain a sequence of elements of any :ref:`Variant<class_Variant>` type by default. Values can optionally be constrained to a specific type by creating a *typed array*. Elements are accessed by a numerical index starting at ``0``. Negative indices are used to count from the back (``-1`` is the last element, ``-2`` is the second to last, etc.).
|
||||
Una struttura dati che può contenere una sequenza di elementi di qualsiasi tipo di :ref:`Variant<class_Variant>`. Gli elementi sono accessibili da un indice numerico a partire da ``0``. È possibile facoltativamente imporre i valori a un tipo specifico creando un *array tipizzato*. Gli indici negativi sono utilizzati per contare dalla fine (``-1`` è l'ultimo elemento, ``-2`` è il penultimo, ecc.).
|
||||
|
||||
|
||||
.. tabs::
|
||||
|
||||
.. code-tab:: gdscript
|
||||
|
||||
var array = ["First", 2, 3, "Last"]
|
||||
print(array[0]) # Prints "First"
|
||||
print(array[2]) # Prints 3
|
||||
print(array[-1]) # Prints "Last"
|
||||
var array = ["Primo", 2, 3, "Ultimo"]
|
||||
print(array[0]) # Stampa "Primo"
|
||||
print(array[2]) # Stampa 3
|
||||
print(array[-1]) # Stampa "Ultimo"
|
||||
|
||||
array[1] = "Second"
|
||||
print(array[1]) # Prints "Second"
|
||||
print(array[-3]) # Prints "Second"
|
||||
array[1] = "Secondo"
|
||||
print(array[1]) # Stampa "Secondo"
|
||||
print(array[-3]) # Stampa "Secondo"
|
||||
|
||||
# This typed array can only contain integers.
|
||||
# Attempting to add any other type will result in an error.
|
||||
# Questo array tipizzato può contenere solo numeri interi.
|
||||
# Aggiungere un valore di qualunque altro tipo genererà un errore.
|
||||
var typed_array: Array[int] = [1, 2, 3]
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
Godot.Collections.Array array = ["First", 2, 3, "Last"];
|
||||
GD.Print(array[0]); // Prints "First"
|
||||
GD.Print(array[2]); // Prints 3
|
||||
GD.Print(array[^1]); // Prints "Last"
|
||||
Godot.Collections.Array array = ["Primo", 2, 3, "Ultimo"];
|
||||
GD.Print(array[0]); // Stampa "Primo"
|
||||
GD.Print(array[2]); // Stampa 3
|
||||
GD.Print(array[^1]);; // Stampa "Ultimo"
|
||||
|
||||
array[1] = "Second";
|
||||
GD.Print(array[1]); // Prints "Second"
|
||||
GD.Print(array[^3]); // Prints "Second"
|
||||
array[2] = "Secondo";
|
||||
GD.Print(array[1]); // Stampa "Secondo"
|
||||
GD.Print(array[^3]); // Stampa "Secondo"
|
||||
|
||||
// This typed array can only contain integers.
|
||||
// Attempting to add any other type will result in an error.
|
||||
// Questo array tipizzato può contenere solo numeri interi.
|
||||
// Aggiungere un valore di qualunque altro tipo genererà un errore.
|
||||
Godot.Collections.Array<int> typedArray = [1, 2, 3];
|
||||
|
||||
|
||||
|
||||
\ **Note:** Arrays are always passed by **reference**. To get a copy of an array that can be modified independently of the original array, use :ref:`duplicate()<class_Array_method_duplicate>`.
|
||||
\ **Nota:** Gli array sono sempre passati per **riferimento**. Per ottenere una copia di un array che può essere modificato indipendentemente dall'array originale, utilizza :ref:`duplicate()<class_Array_method_duplicate>`.
|
||||
|
||||
\ **Note:** Erasing elements while iterating over arrays is **not** supported and will result in unpredictable behavior.
|
||||
\ **Nota:** Rimuovere elementi durante un'iterazione su un array **non** è supportato e risulterà in comportamento imprevedibile.
|
||||
|
||||
\ **Differences between packed arrays, typed arrays, and untyped arrays:** Packed arrays are generally faster to iterate on and modify compared to a typed array of the same type (e.g. :ref:`PackedInt64Array<class_PackedInt64Array>` versus ``Array[int]``). Also, packed arrays consume less memory. As a downside, packed arrays are less flexible as they don't offer as many convenience methods such as :ref:`map()<class_Array_method_map>`. Typed arrays are in turn faster to iterate on and modify than untyped arrays.
|
||||
\ **Differenze tra gli array impacchettati, gli array tipizzati e gli array non tipizzati:** Gli array impacchettati sono generalmente più veloci da iterare e modificare rispetto a un array tipizzato dello stesso tipo (ad esempio :ref:`PackedInt64Array<class_PackedInt64Array>` in confronto a ``Array[int]``). Inoltre, gli array impacchettati consumano meno memoria. Come svantaggio, i array impacchettati sono meno flessibili in quanto non offrono molti metodi di convenienza come :ref:`map()<class_Array_method_map>`. Gli array tipizzati sono anche loro più veloci da iterare e modificare in confronto ad array non tipizzati.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user