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

Function repeat

aiscript-vm/src/builtins/string.rs:362–372  ·  view source on GitHub ↗

Misc string operations

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

Source from the content-addressed store, hash-verified

360
361// Misc string operations
362fn repeat<'gc>(
363 mc: &'gc Mutation<'gc>,
364 receiver: Value<'gc>,
365 args: Vec<Value<'gc>>,
366) -> Result<Value<'gc>, VmError> {
367 let count = float_arg!(&args, 0, "repeat")? as usize;
368
369 let repeated = receiver.as_string_value()?.as_str().repeat(count);
370 // Ok(Value::String(mc.intern(repeated.as_bytes())))
371 Ok(Value::IoString(Gc::new(mc, repeated)))
372}
373
374fn reverse<'gc>(
375 mc: &'gc Mutation<'gc>,

Callers 1

formatMethod · 0.85

Calls 2

as_string_valueMethod · 0.80
as_strMethod · 0.45

Tested by

no test coverage detected