Misc string operations
(
mc: &'gc Mutation<'gc>,
receiver: Value<'gc>,
args: Vec<Value<'gc>>,
)
| 360 | |
| 361 | // Misc string operations |
| 362 | fn 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 | |
| 374 | fn reverse<'gc>( |
| 375 | mc: &'gc Mutation<'gc>, |
no test coverage detected