Socrate 10 Posted August 28, 2010 Is it possible to pass params to an sqf function by reference? Like arrays for examples? or are they already passed by reference? Thanks Socrate Share this post Link to post Share on other sites
rübe 127 Posted August 28, 2010 (edited) Arrays are always passed by reference and if you want to pass something else by reference, put it in an array first, and then you pass that array: A_FUNCTION_THAT_MODIFIES_THE_GIVEN_ARRAY = { _this set [0, objNull]; _this set [1, false]; _this set [2, -78]; }; _params = [ player, true, 12 ]; _params call A_FUNCTION_THAT_MODIFIES_THE_GIVEN_ARRAY; hint format["%1", _params]; And if your intention would be to leave to original array untouched, you'd have to make a copy prior to modifying it: A_FUNCTION_THAT_MODIFIES_THE_GIVEN_ARRAY = { _copy = +_this; _copy set [0, objNull]; _copy set [1, false]; _copy set [2, -78]; _copy }; Edited August 28, 2010 by ruebe Share this post Link to post Share on other sites