class_packedint32array.rst 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the PackedInt32Array.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_PackedInt32Array:
  6. PackedInt32Array
  7. ================
  8. A packed :ref:`Array<class_Array>` of 32-bit integers.
  9. Description
  10. -----------
  11. An :ref:`Array<class_Array>` specifically designed to hold 32-bit integer values. Packs data tightly, so it saves memory for large array sizes.
  12. **Note:** This type is passed by value and not by reference.
  13. **Note:** This type stores signed 32-bit integers, which means it can take values in the interval ``[-2^31, 2^31 - 1]``, i.e. ``[-2147483648, 2147483647]``. Exceeding those bounds will wrap around. In comparison, :ref:`int<class_int>` uses signed 64-bit integers which can hold much larger values. If you need to pack 64-bit integers tightly, see :ref:`PackedInt64Array<class_PackedInt64Array>`.
  14. Methods
  15. -------
  16. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`PackedInt32Array<class_PackedInt32Array_method_PackedInt32Array>` **(** :ref:`Array<class_Array>` from **)** |
  18. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`append<class_PackedInt32Array_method_append>` **(** :ref:`int<class_int>` integer **)** |
  20. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`append_array<class_PackedInt32Array_method_append_array>` **(** :ref:`PackedInt32Array<class_PackedInt32Array>` array **)** |
  22. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`empty<class_PackedInt32Array_method_empty>` **(** **)** |
  24. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`insert<class_PackedInt32Array_method_insert>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` integer **)** |
  26. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`invert<class_PackedInt32Array_method_invert>` **(** **)** |
  28. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`push_back<class_PackedInt32Array_method_push_back>` **(** :ref:`int<class_int>` integer **)** |
  30. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`remove<class_PackedInt32Array_method_remove>` **(** :ref:`int<class_int>` idx **)** |
  32. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`resize<class_PackedInt32Array_method_resize>` **(** :ref:`int<class_int>` idx **)** |
  34. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set<class_PackedInt32Array_method_set>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` integer **)** |
  36. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`size<class_PackedInt32Array_method_size>` **(** **)** |
  38. +-------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------+
  39. Method Descriptions
  40. -------------------
  41. .. _class_PackedInt32Array_method_PackedInt32Array:
  42. - :ref:`PackedInt32Array<class_PackedInt32Array>` **PackedInt32Array** **(** :ref:`Array<class_Array>` from **)**
  43. Constructs a new ``PackedInt32Array``. Optionally, you can pass in a generic :ref:`Array<class_Array>` that will be converted.
  44. ----
  45. .. _class_PackedInt32Array_method_append:
  46. - void **append** **(** :ref:`int<class_int>` integer **)**
  47. Appends an element at the end of the array (alias of :ref:`push_back<class_PackedInt32Array_method_push_back>`).
  48. ----
  49. .. _class_PackedInt32Array_method_append_array:
  50. - void **append_array** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` array **)**
  51. Appends a ``PackedInt32Array`` at the end of this array.
  52. ----
  53. .. _class_PackedInt32Array_method_empty:
  54. - :ref:`bool<class_bool>` **empty** **(** **)**
  55. Returns ``true`` if the array is empty.
  56. ----
  57. .. _class_PackedInt32Array_method_insert:
  58. - :ref:`int<class_int>` **insert** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` integer **)**
  59. Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array (``idx == size()``).
  60. ----
  61. .. _class_PackedInt32Array_method_invert:
  62. - void **invert** **(** **)**
  63. Reverses the order of the elements in the array.
  64. ----
  65. .. _class_PackedInt32Array_method_push_back:
  66. - void **push_back** **(** :ref:`int<class_int>` integer **)**
  67. Appends a value to the array.
  68. ----
  69. .. _class_PackedInt32Array_method_remove:
  70. - void **remove** **(** :ref:`int<class_int>` idx **)**
  71. Removes an element from the array by index.
  72. ----
  73. .. _class_PackedInt32Array_method_resize:
  74. - void **resize** **(** :ref:`int<class_int>` idx **)**
  75. Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
  76. ----
  77. .. _class_PackedInt32Array_method_set:
  78. - void **set** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` integer **)**
  79. Changes the integer at the given index.
  80. ----
  81. .. _class_PackedInt32Array_method_size:
  82. - :ref:`int<class_int>` **size** **(** **)**
  83. Returns the array size.