Back

Array

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:167
src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:35
src/main/java/bt7s7k7/treeburst/runtime/Realm.java:226

Allows the storage of an ordered list of elements, each indexed by a number starting from 0.



Array.prototype.@foreach

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:485

Overloads:

Equivalent to the Array.prototype.foreach function, except this macro inlines the function, allowing you to share the scope and use control flow functions like return and goto.


Array.prototype.append

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:322

Overloads:

Appends the provided elements to the end of the array. Returns the current array.


Array.prototype.clear

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:229

Overloads:

Removes all elements in the array.


Array.prototype.clone

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:223

Overloads:

Creates a copy of the array.


Array.prototype.filter

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:458

Overloads:

Creates a new array with only the elements for which function returned true. The function is called with value of the element, the index of the element and a reference to this array.


Array.prototype.foreach

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:441

Overloads:

Calls a function for every element of this array. The function is called with value of the element, the index of the element and a reference to this array. Returns this array.


Array.prototype.join

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:516

Overloads:

Creates a String as that is a concatenation of all elements of the array. Elements that are not strings are converted to strings using their k_string method.


Array.prototype.k_add

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:542

Overloads:

Creates a new array that is a concatenation of the two input arrays.


Array.prototype.k_at

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:101

Overloads:

Gets or sets an element at the requested index. If an index outside the array is specified, an exception is generated. As always, the index may be negative to index from the end of the array, where -1 is the last element and so on.


Array.prototype.k_dump

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:396

Overloads:

Formats the array into a textual form.


Array.prototype.k_mul

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:557

Overloads:

Creates a new array that is the input array repeated n times.


Array.prototype.map

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:415

Overloads:

Creates a new array with the results of calling function on every element. The function is called with value of the element, the index of the element and a reference to this array. If function returns void, the element is discarded and the resulting array is shorter.


Array.prototype.pop

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:338

Overloads:

Removes the last element of the array and returns it. If the array is empty returns void.


Array.prototype.prepend

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:330

Overloads:

Prepends the provided elements before the start of the array. Returns the current array.


Array.prototype.push

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:360

Overloads:

Adds an element after the end of the array. Returns the last added value.


Array.prototype.shift

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:349

Overloads:

Removes the first element of the array and returns it. If the array is empty returns void.


Array.prototype.slice

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:236

Overloads:

Creates a copy of a section of the array starting at from and ending at to (or the end of the array if not provided). As always, the index may be negative to index from the end of the array, where -1 is the last element and so on.


Array.prototype.splice

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:286

Overloads:

Removes a section of the array at index of length delete. Optionally replacing this section with the elements of insert. If the delete argument is 0, this function is equivalent to an insertion function; in this case the index may point to just after the end of the array. As always, the index may be negative to index from the end of the array, where -1 is the last element and so on.


Array.prototype.truncate

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:197

Overloads:

Sets the length of the array to the provided value. If the new length is shorter, elements at the end are discarded. If the length is longer, new elements are filled with null. Returns a reference to this array.


Array.prototype.tryAt

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:141

Overloads:

Gets or sets an element at the requested index. If an index outside the array is specified, it returns void when reading or the length of array is extended on writing (all added elements are filled with null). As always, the index may be negative to index from the end of the array, where -1 is the last element and so on.


Array.prototype.unshift

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:378

Overloads:

Adds an element before the start of the array. Returns the last added value.


Array.prototype.view

src/main/java/bt7s7k7/treeburst/standard/ArrayPrototype.java:261

Overloads:

Creates a view of a section of the array starting at from and ending at to (or the end of the array if not provided). As always, the index may be negative to index from the end of the array, where -1 is the last element and so on.


Inherited Properties

Table.prototype.@k_and

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:471

Inherited from: Table

Overloads:

This object is converted to a Boolean. If the result is true, the other expression is evaluated and the result retuned, otherwise this object is returned.


Table.prototype.@k_coalesce

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:531

Inherited from: Table

Overloads:

If this object is not null or void, it is returned, otherwise the other expression is evaluated and the result retuned.


Table.prototype.@k_else

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:568

Inherited from: Table

Overloads:

If this object is not void, it is returned, otherwise the other expression is evaluated and the result retuned.


Table.prototype.@k_or

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:494

Inherited from: Table

Overloads:

This object is converted to a Boolean. If the result is true this object is retuned, otherwise the other expression is evaluated and the result retuned.


Table.prototype.k_boolean

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:591

Inherited from: Table

Overloads:

This object is converted to a Boolean.


Table.prototype.k_is

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:602

Inherited from: Table

Overloads:

Returns true if this object is equal by reference to the other object. This function returns inconsistent results for objects of type String and Number, and should not be used with them. The intended use is for reference comparisons between compound objects and null or void, without using their overload of the k_eq operator.


Table.prototype.k_string

src/main/java/bt7s7k7/treeburst/runtime/Realm.java:629

Inherited from: Table

Overloads:

Formats the value into a textual form, using its k_dump implementation