Skip to content

API Int64Array

Liu.Yandong.Hanks edited this page Aug 21, 2026 · 1 revision

Int64Array

Fixed-length packed array of signed 64-bit integers.

Script API Reference

Overview

Int64Array is a primitive-backed array for wide signed integer data such as tick values, byte offsets, and large identifiers. Elements live in contiguous native storage, so the array avoids the per-element object allocation of a general Array.

The length is fixed at construction. push, pop, and element deletion are unavailable; elements are read and written through numeric indexes.

var offsets = new Int64Array(2);
offsets[0] = -1099511627776;
return offsets[0]; // -1099511627776

Warning

Indexing outside 0 to length - 1 raises a runtime error. Validate computed indexes before reading or writing.

Note

Script number values are double-precision. Integers outside the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER cannot be represented exactly as a script number, so they may lose precision on the way into or out of the array.

Constructors

new Int64Array([length])

Parameters

Name Type Required Description
length number No Non-negative element count. Omitting it creates an empty array.

Returns

Int64Array — a fixed-length array whose elements start at 0.

Example

var ticks = new Int64Array(4);
return ticks[3]; // 0

Properties

values.length

Returns

number — the fixed element count.

Behavior

Read-only. The value never changes for a given instance.

Example

return new Int64Array(8).length; // 8

Methods

values.fill([value])

Parameters

Name Type Required Description
value number No Value written to every element. Defaults to 0.

Returns

Int64Array — this array, so calls can be chained.

Behavior

The value is converted to a signed 64-bit integer before it is stored, and every element is overwritten in place.

Example

var ticks = new Int64Array(3);
ticks.fill(1000);
return ticks[2]; // 1000

Clone this wiki locally