SplitScript reference / [T] / set

[T].set

Method

[T].set(index: u32, value: T) -> None

Updates an array element.

This is the standard-library operation behind an array indexing assignment. The array and index are evaluated once and the element is updated in place without structurally invalidating active iteration.

Parameters

  • index: The zero-based element index.
  • value: The new element value.

Effects: mutates the receiver

Runtime behavior: available everywhere; synchronous

Examples

Replace an array element

let fieldNames = ["mana"]
fieldNames.set(0, "health")