pub fn call<S: AsRef<str>, V: AsRef<Self>>(&self, procname: S, args: &[V]) -> DMResult {
		let mut ret = raw_types::values::Value {
			tag: raw_types::values::ValueTag::Null,
			data: raw_types::values::ValueData { id: 0 },
		};

		unsafe {
			// Increment ref-count of args permenently before passing them on
			for v in args {
				raw_types::funcs::inc_ref_count(v.as_ref().into_raw_value());
			}

			let procname = String::from(procname.as_ref()).replace("_", " ");
			let args: Vec<_> = args.iter().map(|e| e.as_ref().into_raw_value()).collect();
			let name_ref = string::StringRef::new(&procname);

			if raw_types::funcs::call_datum_proc_by_name(
				&mut ret,
				Value::null().into_raw_value(),
				2,
				name_ref.value.value.data.string,
				self.value,
				args.as_ptr(),
				args.len(),
				0,
				0,
			) == 1
			{
				return Ok(Value::from_raw_owned(ret));
			}
		}

		Err(runtime!("External proc call failed"))
	}
/// Calls a method of the value with the given arguments.
///
/// # Examples:
///
/// This example is equivalent to `src.explode(3)` in DM.
/// ```ignore
/// src.call("explode", &[&Value::from(3.0)]);
/// ```
Calls a method of the value with the given arguments.
Calls a method of the value with the given arguments .
pub fn call<S: AsRef<str>, V: AsRef<Self>>(&self, procname: S, args: &[V]) -> DMResult {
		let mut ret = raw_types::values::Value {
			tag: raw_types::values::ValueTag::Null,
			data: raw_types::values::ValueData { id: 0 },
		};
		unsafe {
			// Increment ref-count of args permenently before passing them on
			for v in args {
				raw_types::funcs::inc_ref_count(v.as_ref().into_raw_value());
			}
			let procname = String::from(procname.as_ref()).replace("_", " ");
			let args: Vec<_> = args.iter().map(|e| e.as_ref().into_raw_value()).collect();
			let name_ref = string::StringRef::new(&procname);
			if raw_types::funcs::call_datum_proc_by_name(
				&mut ret,
				Value::null().into_raw_value(),
				2,
				name_ref.value.value.data.string,
				self.value,
				args.as_ptr(),
				args.len(),
				0,
				0,
			) == 1
			{
				return Ok(Value::from_raw_owned(ret));
			}
		}
		Err(runtime!("External proc call failed"))
	}
pub fn call < S : AsRef < str > , V : AsRef < Self > > ( & self , procname : S , args : & [ V ] ) -> DMResult { let mut ret = raw_types :: values :: Value { tag : raw_types :: values :: ValueTag :: Null , data : raw_types :: values :: ValueData { id : 0 } , } ; unsafe { // Increment ref-count of args permenently before passing them on for v in args { raw_types :: funcs :: inc_ref_count ( v . as_ref ( ) . into_raw_value ( ) ) ; } let procname = String :: from ( procname . as_ref ( ) ) . replace ( " " , " " ) ; let args : Vec < _ > = args . iter ( ) . map ( | e | e . as_ref ( ) . into_raw_value ( ) ) . collect ( ) ; let name_ref = string :: StringRef :: new ( & procname ) ; if raw_types :: funcs :: call_datum_proc_by_name ( & mut ret , Value :: null ( ) . into_raw_value ( ) , 2 , name_ref . value . value . data . string , self . value , args . as_ptr ( ) , args . len ( ) , 0 , 0 , ) == 1 { return Ok ( Value :: from_raw_owned ( ret ) ) ; } } Err ( runtime ! ( " " ) ) }
Calls a method of the value with the given arguments.
Calls a method of the value with the given arguments .
&self
procname
S
args
&[V]
examples:
This example is equivalent to `src.explode(3)` in DM.
This example is equivalent to ` src . explode ( 3 ) ` in DM .