BIS fnc param: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "_{10,} " to "") |
Lou Montana (talk | contribs) m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...) |
||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
| arma3 | | arma3 | ||
|0.50 | |0.50 | ||
|gr1 = Arrays | |gr1 = Arrays | ||
| Load a script parameter. See [[Functions_Library (Arma_3)#Loading_Parameters|Functions Library (Arma 3)]] for detailed description. | | Load a script parameter. See [[Functions_Library (Arma_3)#Loading_Parameters|Functions Library (Arma 3)]] for detailed description. | ||
{{Feature|arma3|This function is obsolete since the introduction of [[param]] and [[params]].}} | {{Feature|arma3|This function is obsolete since the introduction of [[param]] and [[params]].}} | ||
| [input,index,(defaultValue,dataTypes,requiredCount)] call [[BIS_fnc_param]]; | | [input,index,(defaultValue,dataTypes,requiredCount)] call [[BIS_fnc_param]]; | ||
|p1= input: [[Array]] - list of params | |p1= input: [[Array]] - list of params | ||
|p2= index: [[Number]] - selected index | |p2= index: [[Number]] - selected index | ||
|p3= defaultValue (Optional): [[Anything]] - default param (used when param is missing or of wrong type).<br>You can overload default value by declaring variable ''BIS_fnc_<functionName>_<index>'' in [[Namespace]] where BIS_fnc_param is called from.<br>[[BIS_fnc_paramIn]] is a variant of the function with overloading disabled. | |p3= defaultValue (Optional): [[Anything]] - default param (used when param is missing or of wrong type).<br>You can overload default value by declaring variable ''BIS_fnc_<functionName>_<index>'' in [[Namespace]] where BIS_fnc_param is called from.<br>[[BIS_fnc_paramIn]] is a variant of the function with overloading disabled. | ||
|p4= dataTypes (Optional): [[Array]] - list of allowed type examples (e.g. ["",[],0,[[objNull]]<nowiki>]</nowiki>) | |p4= dataTypes (Optional): [[Array]] - list of allowed type examples (e.g. ["",[],0,[[objNull]]<nowiki>]</nowiki>) | ||
|p5= requiredCount (Optional): [[Number]] or [[Array]] - If value is Array, checks if it has required number of elements | |p5= requiredCount (Optional): [[Number]] or [[Array]] - If value is Array, checks if it has required number of elements | ||
| [[Anything]] | | [[Anything]] | ||
|x1= <code>_target <nowiki>=</nowiki> [_this, 0, [[objNull]], [<nowiki/>[[objNull]],[]], [2,3]] [[call]] [[BIS_fnc_param]];</code> | |x1= <code>_target <nowiki>=</nowiki> [_this, 0, [[objNull]], [<nowiki/>[[objNull]],[]], [2,3]] [[call]] [[BIS_fnc_param]];</code> | ||
Line 29: | Line 29: | ||
* 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) 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. | * 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= <code>_answer <nowiki>=</nowiki> [_this, 1, 42] [[call]] [[BIS_fnc_param]];</code> | |x2= <code>_answer <nowiki>=</nowiki> [_this, 1, 42] [[call]] [[BIS_fnc_param]];</code> | ||
* If (_this select 1) is not defined, default 42 is used. | * If (_this select 1) is not defined, default 42 is used. | ||
* No limit for data types or number of elements exists. | * No limit for data types or number of elements exists. | ||
| [[BIS_fnc_paramIn]] [[param]] [[params]] | |||
| [[BIS_fnc_paramIn]] [[param]] [[params]] | |||
}} | }} |
Revision as of 23:41, 17 January 2021
Description
- Description:
- Load a script parameter. See Functions Library (Arma 3) 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): 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): 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:
_target = [_this, 0, objNull, [objNull,[]], [2,3]] call BIS_fnc_param;
- 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:
_answer = [_this, 1, 42] call BIS_fnc_param;
- 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
Notes
- Posted: 21:55 Sep 6 2014
- ffur2007slx2_5
- (A3 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;