gnif 1 Posted May 24, 2014 Hi All, I am attempting to create a nice little framework for overriding/extnding pre compiled functions, which I cant seem to get to work properly. overrideMethod = { private ["_oldFn", "_list", "_params", "_result", "_handled"]; _oldFn = _this select 0; _list = _this select 1; _params = _this select 2; _handled = false; { // call the method _result = _params call _x; // check if the call has been handled if ((_result select 0)) exitWith { _handled = true; _result = _result select 1; }; } forEach _list; if (!_handled) then { _result = _params call _oldFn; }; _result }; // method overrides if (!isNil "fnc_usec_selfActions") then { fnc_usec_selfActionsOrig = fnc_usec_selfActions; fnc_usec_selfActionsList = []; fnc_usec_selfActions = { private ["_result"]; _result = [fnc_usec_selfActionsOrig, fnc_usec_selfActionsList, _this] call overrideMethod; _result }; // this looks strange here, but it is here because this code is generated dynamically by a patching API. fnc_usec_selfActionsList set [count fnc_usec_selfActionsList, compile preprocessFileLineNumbers "extended.sqf"]; }; I am getting the following error (client side only). Error in expression <h _list; if (!_handled) then { _result = _params call _oldFn; }; _result }; > Error position: <= _params call _oldFn; }; _result }; > Error Generic error in expression File mpmissions\__CUR_MP.Chernarus\overrides.sqf, line 23 I do not understand what is wrong here. It seems if I put a diagLog "Testing"; before calling _oldFn it fixes the issue. Share this post Link to post Share on other sites
gnif 1 Posted May 24, 2014 I found the problem... fnc_usec_selfActions does not return anything, so _result = _params call fnc_usec_selfActions fails. Would have been nice Share this post Link to post Share on other sites