BIS fnc param: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Some wiki formatting) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 28: | Line 28: | ||
|x1= <sqf>_target = [_this, 0, objNull, [objNull,[]], [2,3]] call BIS_fnc_param;</sqf> | |x1= <sqf>_target = [_this, 0, objNull, [objNull,[]], [2,3]] call BIS_fnc_param;</sqf> | ||
* | * if (_this select 0) is not defined, default objnull is used. | ||
* | * if (_this select 0) is defined, but is neither of type [[Object]] nor [[Array]], error message is logged and default [[objNull]] is used. | ||
* | * 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. | ||
|x2= <sqf>_answer = [_this, 1, 42] call BIS_fnc_param;</sqf> | |x2= <sqf>_answer = [_this, 1, 42] call BIS_fnc_param;</sqf> | ||
* | * if (_this select 1) is not defined, default 42 is used. | ||
* | * no limit for data types or number of elements exists. | ||
|seealso= [[BIS_fnc_paramIn]] [[param]] [[params]] | |seealso= [[BIS_fnc_paramIn]] [[param]] [[params]] | ||
Line 43: | Line 43: | ||
|timestamp= 20140906215500 | |timestamp= 20140906215500 | ||
|text= {{GVI|arma3|1.28}} Use [[BIS_fnc_paramIn]] to load private path from parent parameters (loaded by [[BIS_fnc_param]]) | |text= {{GVI|arma3|1.28}} Use [[BIS_fnc_paramIn]] to load private path from parent parameters (loaded by [[BIS_fnc_param]]) | ||
<sqf>private ["_parent","_child0","_child1"]; | <sqf> | ||
_parent = [_this,0,[],[[]]] call BIS_fnc_param; | private ["_parent", "_child0", "_child1"]; | ||
_child0 = [_parent,0,missionNamespace,[ missionNamespace,grpNull,objNull ]] call BIS_fnc_paramIn; | _parent = [_this, 0, [], [[]]] call BIS_fnc_param; | ||
_child1 = [_parent,1,"",[""]] call BIS_fnc_paramIn; | _child0 = [_parent, 0, missionNamespace, [missionNamespace, grpNull, objNull]] call BIS_fnc_paramIn; | ||
_child1 = [_parent, 1, "", [""]] call BIS_fnc_paramIn; | |||
</sqf> | </sqf> | ||
}} | }} |
Revision as of 01:54, 1 August 2022
Description
- Description:
- Load a script parameter. See Arma 3: Functions Library for detailed description.
- Execution:
- call
- Groups:
- Arrays
Syntax
- Syntax:
- [input, index, defaultValue, dataTypes, requiredCount] call BIS_fnc_param
- Parameters:
- input: Array - List of params
- index: Number - Selected index
- defaultValue (Optional, default Nothing): Anything - Default param (used when param is missing or of wrong type).
You can overload default value by declaring variable BIS_fnc_<functionName>_<index> in Namespace where BIS_fnc_param is called from.
BIS_fnc_paramIn is a variant of the function with overloading disabled. - dataTypes (Optional, default Anything): Array - List of allowed type examples (e.g. ["",[],0,objNull])
- requiredCount (Optional): Number or Array - If value is Array, checks if it has required number of elements
- Return Value:
- Anything
Examples
- Example 1:
-
- if (_this select 0) is not defined, default objnull is used.
- if (_this select 0) is defined, but is neither of type Object nor Array, error message is logged and default objNull is used.
- 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.
- Example 2:
-
- if (_this select 1) is not defined, default 42 is used.
- no limit for data types or number of elements exists.
Additional Information
- See also:
- BIS_fnc_paramIn param params
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on Sep 06, 2014 - 21:55 (UTC)
-
1.28 Use BIS_fnc_paramIn to load private path from parent parameters (loaded by BIS_fnc_param)
private ["_parent", "_child0", "_child1"]; _parent = [_this, 0, [], [[]]] call BIS_fnc_param; _child0 = [_parent, 0, missionNamespace, [missionNamespace, grpNull, objNull]] call BIS_fnc_paramIn; _child1 = [_parent, 1, "", [""]] call BIS_fnc_paramIn;