(
_mc: &'gc Mutation<'gc>,
receiver: Value<'gc>,
args: Vec<Value<'gc>>,
)
| 182 | } |
| 183 | |
| 184 | fn last_index_of<'gc>( |
| 185 | _mc: &'gc Mutation<'gc>, |
| 186 | receiver: Value<'gc>, |
| 187 | args: Vec<Value<'gc>>, |
| 188 | ) -> Result<Value<'gc>, VmError> { |
| 189 | let substr = string_arg!(&args, 0, "last_index_of")?; |
| 190 | |
| 191 | let s = receiver.as_string_value()?; |
| 192 | let s = s.as_str(); |
| 193 | let substr = substr.to_str().unwrap(); |
| 194 | |
| 195 | match s.rfind(substr) { |
| 196 | Some(pos) => Ok(Value::Number(pos as f64)), |
| 197 | None => Ok(Value::Number(-1.0)), |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | // Substring and slicing |
| 202 | fn substring<'gc>( |
nothing calls this directly
no test coverage detected