-
Notifications
You must be signed in to change notification settings - Fork 0
/
fnc_tell.sqf
26 lines (26 loc) · 1.48 KB
/
fnc_tell.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/////////////////////////////// fnc_tell /////////////////////////// 2016-10-23
/* Send a message to an object, collecting the result */
///////////////////////////////////////////////////////////
private [ //
"_instance", // Vehicle [IN/0] //
"_message", // String [IN/1] ////
"_parameters", // Array [IN/2[,3..]] //////
"_classes", // alists /// ///
"_methods", // alist /// ///
"_result" // Element [OUT] /// ///
]; /////////////////////////////////////// <dwringer@gmail.com> /// ///
_instance = _this select 0;
_message = _this select 1;
_parameters = [_this, 2, 0] call fnc_subseq;
_classes = [[["_cname"],
"[_cname, Classes] call fnc_alist_get"] call fnc_lambdastr,
_instance getVariable ["class_names", []]] call fnc_map;
_methods = [[["_method_list", "_msg"],
"[_msg, _method_list] call fnc_alist_get"] call fnc_lambdastr,
_classes, [_message]] call fnc_mapwith;
_methods = [[["_x"], "not isNil ""_x"""] call fnc_lambdastr,
_methods] call fnc_filter;
_result = ([_instance] + _parameters) call (_methods select 0);
if (not isNil "_result") then {
_result;
}; // RETURN //////////////////////////////////////////////////////////