{"name":"BIS_fnc_param","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","games":{"tkoh":"1.00","arma3":"0.50"},"since":"tkoh 1.00","arma3_since":"0.50","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","params":[{"name":"input","type":"Array","description":"list of params","type_expr":"Array"},{"name":"index","type":"Number","description":"selected index","type_expr":"Number"},{"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.","type_expr":"Anything","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])","type_expr":"Array","text":"dataTypes: Array - (Optional, default Anything) list of allowed type examples (e.g. [\"\",[],0,objNull])"},{"name":"requiredCount","type":"Number or Array","optional":true,"description":"if value is Array, checks if it has required number of elements","type_expr":"Number | Array","text":"requiredCount: Number or Array - (Optional) if value is Array, checks if it has required number of elements"}],"returns":{"type":"Anything","type_expr":"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;"]}],"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```"}]}