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

import array

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

UInt16Array: a packed array of unsigned 16-bit integers, 2 bytes per element.

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

Constants

UINT16_MAX

array.UINT16_MAX: number = 65535

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

Classes

UInt16Array

class array.UInt16Array < Array

class UInt16Array represents an array of twos-complement 16-bit unsigned 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

UInt16Array.reverse()

array.UInt16Array.reverse() -> UInt16Array

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

Returns UInt16Array

UInt16Array.clone()

array.UInt16Array.clone() -> UInt16Array

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

Returns UInt16Array

UInt16Array.slice()

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

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

Parameters

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

Returns UInt16Array


2021, Richard Ore and Zuri contributors