Add array API with closure variation that binds to this.

This commit is contained in:
Stephen Chung
2022-12-24 19:37:06 +08:00
parent ffa1f5fb4a
commit fd401f3048
6 changed files with 162 additions and 70 deletions

View File

@@ -674,7 +674,7 @@ pub mod deprecated_array_functions {
#[rhai_fn(name = "map", return_raw)]
pub fn map_by_fn_name(
ctx: NativeCallContext,
array: Array,
array: &mut Array,
mapper: &str,
) -> RhaiResultOf<Array> {
map(ctx, array, FnPtr::new(mapper)?)
@@ -712,7 +712,7 @@ pub mod deprecated_array_functions {
#[rhai_fn(name = "filter", return_raw)]
pub fn filter_by_fn_name(
ctx: NativeCallContext,
array: Array,
array: &mut Array,
filter_func: &str,
) -> RhaiResultOf<Array> {
filter(ctx, array, FnPtr::new(filter_func)?)