BIS fnc param: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Killzone Kid (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [input,index,(defaultValue,dataTypes,requiredCount)] call | | [input,index,(defaultValue,dataTypes,requiredCount)] call [[BIS_fnc_param]]; |= Syntax | ||
|p1= input: [[Array]] - list of params |= Parameter 1 | |p1= input: [[Array]] - list of params |= Parameter 1 | ||
Line 18: | Line 18: | ||
|p3= defaultValue (Optional): [[Anything]] - default param (used when param is missing or of wrong type). You can overload default value by setting 'BIS_fnc_<functionName>_<index>' |= Parameter 2 | |p3= defaultValue (Optional): [[Anything]] - default param (used when param is missing or of wrong type). You can overload default value by setting 'BIS_fnc_<functionName>_<index>' |= Parameter 2 | ||
|p4= dataTypes (Optional): [[Array]] - list of allowed type examples (e.g. ["",[],0, | |p4= dataTypes (Optional): [[Array]] - list of allowed type examples (e.g. ["",[],0,[[objNull]]<nowiki>]</nowiki>) |= Parameter 2 | ||
|p5= requiredCount (Optional): [[Number]] - If value is Array, checks if it has required number of elements |= Parameter 2 | |p5= requiredCount (Optional): [[Number]] - If value is Array, checks if it has required number of elements |= Parameter 2 | ||
Line 25: | Line 25: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_target <nowiki>=</nowiki> [_this, 0, [[objNull]], [objNull,[]], [2,3]] call | |x1= <code>_target <nowiki>=</nowiki> [_this, 0, [[objNull]], <nowiki>[</nowiki>[[objNull]],[]], [2,3]] [[call]] [[BIS_fnc_param]];</code> | ||
* If (_this select 0) is not defined, default objnull is used. | * 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) 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's count is neither 2 nor 3, error message is logged and default objNull is used. | * If (_this select 0) and is [[Array]], but it's count is neither 2 nor 3, error message is logged and default [[objNull]] is used. | ||
|= Example 1 | |= Example 1 | ||
|x2= <code>_answer <nowiki>=</nowiki> [_this, 1, 42] call | |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. |
Revision as of 21:50, 12 August 2013
Description
- Description:
- Load a script parameter. See Functions Library (Arma 3) for detailed description.
- Execution:
- call
- Groups:
- Uncategorised
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 setting 'BIS_fnc_<functionName>_<index>'
- dataTypes (Optional): Array - list of allowed type examples (e.g. ["",[],0,objNull])
- requiredCount (Optional): Number - 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's 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:
- See also needed
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