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.int8

import array

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

Int8Array: a packed array of twos-complement 8-bit signed integers, 1 byte per element.

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

Constants

INT8_MAX

array.INT8_MAX: number = 127

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

INT8_MIN

array.INT8_MIN: number

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

Classes

Int8Array

class array.Int8Array < Array

class Int8Array represents an array of twos-complement 8-bit signed integers.

  • 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

Int8Array.reverse()

array.Int8Array.reverse() -> Int8Array

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

Returns Int8Array

Int8Array.clone()

array.Int8Array.clone() -> Int8Array

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

Returns Int8Array

Int8Array.slice()

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

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

Parameters

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

Returns Int8Array


2021, Richard Ore and Zuri contributors