Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

array.int32

import array

Everything here is re-exported by array, so import array is enough and the names are called as array.*. Importing array.int32 on its own works too and reaches the same definitions.

Int32Array: a packed array of twos-complement 32-bit signed integers, 4 bytes per element.

INT32_MAX and INT32_MIN bound what an element may be; a value outside them raises rather than wrapping.

Constants

INT32_MAX

array.INT32_MAX: number = 2147483647

Maximum value that “should” exist in a list passed to Int32Array.

INT32_MIN

array.INT32_MIN: number

Minimum value that “should” exist in a list passed to Int32Array.

Classes

Int32Array

class array.Int32Array < Array

class Int32Array represents an array of twos-complement 32-bit signed integers in the platform byte order.

  • printable — has a @to_string(), so echo and print() show something useful
  • serializable — has a @to_json(), so it can be handed straight to json.encode()
  • valueable — has a @to_value(), so it converts to a plain Zuri value

Int32Array.reverse()

array.Int32Array.reverse() -> Int32Array

Returns a new array containing the elements in the original array in reverse order.

Returns Int32Array

Int32Array.clone()

array.Int32Array.clone() -> Int32Array

Returns a new Int32Array containing all items from the current array. The new array is a shallow copy of the original array.

Returns Int32Array

Int32Array.slice()

array.Int32Array.slice(start, end) -> Int32Array

Returns a new Int32Array over [start, end) of this array (both default to the whole array; negative bounds count from the end).

Parameters

  • start (?number)
  • end (?number)

Returns Int32Array


2021, Richard Ore and Zuri contributors