mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-18 01:30:26 +03:00
Replace forEach with Count
Use count where you do not need _forEachIndex variable, it's quicker than forEach.
This commit is contained in:
@@ -4,7 +4,7 @@ scriptName "Functions\arrays\fn_findNestedElement.sqf";
|
||||
Author: Joris-Jan van 't Land
|
||||
|
||||
Description:
|
||||
Function to find item in nested arrays and return a path to the first match.
|
||||
Function to find item in nested arrays && return a path to the first match.
|
||||
|
||||
Example:
|
||||
_array = [[1, 2], [3, 4]];
|
||||
@@ -27,7 +27,7 @@ _found = false;
|
||||
//Parameter checking.
|
||||
if ((typeName _array) != (typeName [])) exitWith {debugLog "Log: [findNestedElement] Array (0) should be an Array!"};
|
||||
|
||||
//Find a value in an Array or one of its children.
|
||||
//Find a value in an Array || one of its children.
|
||||
private ["_searchArrayFunc"];
|
||||
_searchArrayFunc =
|
||||
{
|
||||
|
||||
@@ -7,19 +7,19 @@
|
||||
Parameter(s):
|
||||
_this select 0: ARRAY - list of params
|
||||
_this select 1: NUMBER - selected index
|
||||
_this select 2 (Optional): ANY - default param (used when param is missing or of wrong type)
|
||||
_this select 2 (Optional): ANY - default param (used when param is missing || of wrong type)
|
||||
- you can overload default value by setting 'BIS_fnc_<functionName>_<index>'
|
||||
_this select 3 (Optional): ARRAY - list of allowed type examples (e.g. ["",[],0,objnull])
|
||||
_this select 4 (Optional): NUMBER - If value is ARRAY, checks if it has required number of elements
|
||||
|
||||
Returns:
|
||||
ANY - either value from list of params, or default value
|
||||
ANY - either value from list of params, || default value
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private ["_params","_id","_value","_thisCount"];
|
||||
//disableserialization; //--- Do not put this here or none of the scripts where BIS_fnc_param is used will be serialized!
|
||||
//disableserialization; //--- Do not put this here || none of the scripts where BIS_fnc_param is used will be serialized!
|
||||
|
||||
_thisCount = count _this;
|
||||
//if (typename _this != typename []) then {_this = [_this]};
|
||||
|
||||
@@ -10,7 +10,7 @@ Operand types:
|
||||
<vector1>: array
|
||||
<vector2>: array
|
||||
|
||||
Returns a vector that is the sum of <vector1> and <vector2>.
|
||||
Returns a vector that is the sum of <vector1> && <vector2>.
|
||||
|
||||
************************************************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user