call_array_method

Function call_array_method 

Source
pub fn call_array_method(
    arr: &mut Vec<Value>,
    method: &str,
    args: &[Value],
) -> GentResult<Value>
Expand description

Call a method on an array value (non-lambda methods only)

§Arguments

  • arr - The array to call the method on (mutable for push/pop)
  • method - The method name
  • args - Arguments to the method

§Supported Methods

  • length() - Returns the number of elements
  • push(value) - Adds an element to the end (mutates array)
  • pop() - Removes and returns the last element (mutates array)
  • indexOf(value) - Returns index of first occurrence, or -1
  • join(separator) - Joins elements into a string
  • slice(start, end) - Returns a new array with elements from start to end
  • concat(other) - Returns a new array combining this and other