{"name":"BIS_fnc_param","operator":null,"title":"BIS fnc param","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_param","revid":349153,"updated":"2023-11-08T14:49:49Z","groups":["Arrays"],"status":"ok","replaced_by":[],"games":[{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Load a script parameter. See Arma 3: Functions Library for detailed description.\n\n> [!NOTE]\n> **Arma 3:** Use param or params commands instead.","syntaxes":[{"syntax":"[input, index, defaultValue, dataTypes, requiredCount] call BIS_fnc_param","since":null,"effect":null,"exec":null,"params":[{"name":"input","type":"Array","optional":false,"default":null,"description":"list of params","types":["Array"],"since":null,"text":"input: Array - list of params"},{"name":"index","type":"Number","optional":false,"default":null,"description":"selected index","types":["Number"],"since":null,"text":"index: Number - selected index"},{"name":"defaultValue","type":"Anything","optional":true,"default":"Nothing","description":"default param (used when param is missing or of wrong type).\nYou can overload default value by declaring variable *BIS_fnc_<functionName>_<index>* in Namespace where BIS_fnc_param is called from.\nBIS_fnc_paramIn is a variant of the function with overloading disabled.","types":["Anything"],"since":null,"text":"defaultValue: Anything - (Optional, default Nothing) default param (used when param is missing or of wrong type).\nYou can overload default value by declaring variable *BIS_fnc_<functionName>_<index>* in Namespace where BIS_fnc_param is called from.\nBIS_fnc_paramIn is a variant of the function with overloading disabled."},{"name":"dataTypes","type":"Array","optional":true,"default":"Anything","description":"list of allowed type examples (e.g. [\"\",[],0,objNull])","types":["Array"],"since":null,"text":"dataTypes: Array - (Optional, default Anything) list of allowed type examples (e.g. [\"\",[],0,objNull])"},{"name":"requiredCount","type":"Number or Array","optional":true,"default":null,"description":"if value is Array, checks if it has required number of elements","types":["Number","Array"],"since":null,"text":"requiredCount: Number or Array - (Optional) if value is Array, checks if it has required number of elements"}],"returns":{"type":"Anything","types":["Anything"],"description":null,"text":"Anything"}}],"examples":[{"text":"```sqf\n_target = [_this, 0, objNull, [objNull,[]], [2,3]] call BIS_fnc_param;\n```\n\n- if (_this select 0) is not defined, default objnull is used.\n- if (_this select 0) is defined, but is neither of type Object nor Array, error message is logged and default objNull is used.\n- if (_this select 0) and is Array, but it is count is neither 2 nor 3, error message is logged and default objNull is used.","code":["_target = [_this, 0, objNull, [objNull,[]], [2,3]] call BIS_fnc_param;"]},{"text":"```sqf\n_answer = [_this, 1, 42] call BIS_fnc_param;\n```\n\n- if (_this select 1) is not defined, default 42 is used.\n- no limit for data types or number of elements exists.","code":["_answer = [_this, 1, 42] call BIS_fnc_param;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_paramIn","param","params"],"notes":[{"user":"ffur2007slx2_5","date":"2014-09-06T21:55:00Z","text":"Arma 3 v1.28 Use BIS_fnc_paramIn to load private path from parent parameters (loaded by BIS_fnc_param)\n\n```sqf\nprivate [\"_parent\", \"_child0\", \"_child1\"];\n_parent = [_this, 0, [], [[]]] call BIS_fnc_param;\n_child0 = [_parent, 0, missionNamespace, [missionNamespace, grpNull, objNull]] call BIS_fnc_paramIn;\n_child1 = [_parent, 1, \"\", [\"\"]] call BIS_fnc_paramIn;\n```"}],"categories":["Arma 3: Functions","Function Group: Arrays","Functions","Introduced with Take On Helicopters version 1.00","Take On Helicopters: Functions","Take On Helicopters: New Functions"],"docblock":null,"filled_from_docblock":[]}