MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / reverse

Function reverse

aiscript-vm/src/builtins/array.rs:350–361  ·  view source on GitHub ↗

Reverse the elements of the list in place

(
    mc: &'gc Mutation<'gc>,
    receiver: Value<'gc>,
    _args: Vec<Value<'gc>>,
)

Source from the content-addressed store, hash-verified

348
349// Reverse the elements of the list in place
350fn reverse<'gc>(
351 mc: &'gc Mutation<'gc>,
352 receiver: Value<'gc>,
353 _args: Vec<Value<'gc>>,
354) -> Result<Value<'gc>, VmError> {
355 let list = receiver.as_array()?;
356
357 let mut list_mut = list.borrow_mut(mc);
358 list_mut.data.reverse();
359
360 Ok(receiver)
361}

Callers

nothing calls this directly

Calls 2

as_arrayMethod · 0.80
borrow_mutMethod · 0.45

Tested by

no test coverage detected