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

Function clear

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

Remove all items from the list

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

Source from the content-addressed store, hash-verified

175
176// Remove all items from the list
177fn clear<'gc>(
178 mc: &'gc Mutation<'gc>,
179 receiver: Value<'gc>,
180 _args: Vec<Value<'gc>>,
181) -> Result<Value<'gc>, VmError> {
182 let list = receiver.as_array()?;
183
184 let mut list_mut = list.borrow_mut(mc);
185 list_mut.data.clear();
186
187 Ok(receiver)
188}
189
190// Return zero-based index of the first item with value equal to x
191fn index<'gc>(

Callers

nothing calls this directly

Calls 2

as_arrayMethod · 0.80
borrow_mutMethod · 0.45

Tested by

no test coverage detected