Quirrel4.41.0

types.Array.replace

Method on every array
array.replace(other: array): any

Deprecated alias of replace_with.

The binding carries no declaration string, so the VM cannot report parameter names. The names above are from this page; the types and attributes still come from the VM. The VM also cannot tell an optional parameter from a variadic tail here, so read the brackets and any trailing ... from the prose below, not from the signature.

Parameters

otherarraythe array to copy elements from

Return value

This array.

Notes

replace and replace_with are the exact same native function registered under two names; use replace_with, the newer name, in new code.

Example

examples/types/array/replace.nut
// replace is a deprecated alias; replace_with is the same function under a new name
let a = [1, 2, 3];
let same = a.replace([7, 8]);
println("same == a:", same == a);
println("a =", ", ".join(a.map(@(v) v.tostring())));
Output:
same == a: true
a = 7, 8

See also

replace_withOverwrites this array's elements with other's.
arrayclass index