Restore call_fn_dynamic.
This commit is contained in:
parent
69054f1b69
commit
c7dfbd48a6
@ -65,7 +65,7 @@ anything that implements `AsMut<Dynamic>` (such as a simple array or a `Vec<Dyna
|
|||||||
```rust
|
```rust
|
||||||
let result = engine.call_fn_dynamic(
|
let result = engine.call_fn_dynamic(
|
||||||
&mut scope, // scope to use
|
&mut scope, // scope to use
|
||||||
ast.into(), // get 'Module' from 'AST'
|
&ast, // AST containing the functions
|
||||||
"hello", // function entry-point
|
"hello", // function entry-point
|
||||||
None, // 'this' pointer, if any
|
None, // 'this' pointer, if any
|
||||||
[ String::from("abc").into(), 123_i64.into() ] // arguments
|
[ String::from("abc").into(), 123_i64.into() ] // arguments
|
||||||
@ -85,7 +85,7 @@ let mut value: Dynamic = 1_i64.into();
|
|||||||
|
|
||||||
let result = engine.call_fn_dynamic(
|
let result = engine.call_fn_dynamic(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
ast.into(),
|
&ast,
|
||||||
"action",
|
"action",
|
||||||
Some(&mut value), // binding the 'this' pointer
|
Some(&mut value), // binding the 'this' pointer
|
||||||
[ 41_i64.into() ]
|
[ 41_i64.into() ]
|
||||||
|
@ -1571,14 +1571,14 @@ impl Engine {
|
|||||||
pub fn call_fn_dynamic(
|
pub fn call_fn_dynamic(
|
||||||
&self,
|
&self,
|
||||||
scope: &mut Scope,
|
scope: &mut Scope,
|
||||||
lib: &Module,
|
lib: impl AsRef<Module>,
|
||||||
name: &str,
|
name: &str,
|
||||||
mut this_ptr: Option<&mut Dynamic>,
|
mut this_ptr: Option<&mut Dynamic>,
|
||||||
mut arg_values: impl AsMut<[Dynamic]>,
|
mut arg_values: impl AsMut<[Dynamic]>,
|
||||||
) -> FuncReturn<Dynamic> {
|
) -> FuncReturn<Dynamic> {
|
||||||
let mut args: StaticVec<_> = arg_values.as_mut().iter_mut().collect();
|
let mut args: StaticVec<_> = arg_values.as_mut().iter_mut().collect();
|
||||||
|
|
||||||
self.call_fn_dynamic_raw(scope, lib, name, &mut this_ptr, args.as_mut())
|
self.call_fn_dynamic_raw(scope, lib.as_ref(), name, &mut this_ptr, args.as_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call a script function defined in an `AST` with multiple `Dynamic` arguments.
|
/// Call a script function defined in an `AST` with multiple `Dynamic` arguments.
|
||||||
|
Loading…
Reference in New Issue
Block a user