Skip to content

Commit

Permalink
Merge pull request #212 from commy2/findNilNullImprovements
Browse files Browse the repository at this point in the history
Support configNull and teamMemberNull in CBA_fnc_findNull, use params in CBA_fnc_findNil
  • Loading branch information
Killswitch00 committed Dec 11, 2015
2 parents 437cd89 + 6c23e02 commit b3ec002
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions addons/arrays/fnc_findNil.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Parameters:
Example:
(begin example)
_index = ["", Player, "test", nil, VARIABLE, nil] call CBA_fnc_findNil
_index = ["", player, "test", nil, _variable, nil] call CBA_fnc_findNil
(end)
Returns:
Expand All @@ -20,14 +20,14 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"

if !(IS_ARRAY(_this)) exitWith {-1};
[_this] params [["_array", [], [[]]]];

scopeName "main";

{
if (isNil "_x") then {
_forEachIndex breakOut "main";
};
} forEach _this;
} forEach _array;

-1
12 changes: 5 additions & 7 deletions addons/arrays/fnc_findNull.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Parameters:
Example:
(begin example)
_index = ["", Player, "test", objNull, VARIABLE] call CBA_fnc_findNull
_index = ["", player, "test", objNull, _variable] call CBA_fnc_findNull
(end)
Returns:
Expand All @@ -20,18 +20,16 @@ Author:
---------------------------------------------------------------------------- */
#include "script_component.hpp"

if !(IS_ARRAY(_this)) exitWith {-1};
[_this] params [["_array", [], [[]]]];

scopeName "main";

private "_checkableTypes";

_checkableTypes = ["OBJECT", "CONTROL", "DISPLAY", "GROUP", "LOCATION", "TASK", "SCRIPT"];
private _nullTypes = [objNull, controlNull, displayNull, grpNull, teamMemberNull, locationNull, taskNull, scriptNull, configNull];

{
if (typeName _x in _checkableTypes && {isNull _x}) then {
if (_x in _nullTypes) then {
_forEachIndex breakOut "main";
};
} forEach _this;
} forEach _array;

-1
1 change: 1 addition & 0 deletions addons/arrays/test_findNil.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SCRIPT(test_findNil);

// ----------------------------------------------------------------------------

disableSerialization;
private ["_expected", "_result", "_fn"];

_fn = "CBA_fnc_findNil";
Expand Down
1 change: 1 addition & 0 deletions addons/arrays/test_findNull.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SCRIPT(test_findNull);

// ----------------------------------------------------------------------------

disableSerialization;
private ["_original", "_expected", "_result", "_fn"];

_fn = "CBA_fnc_findNull";
Expand Down
1 change: 1 addition & 0 deletions addons/arrays/test_findTypeName.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SCRIPT(test_findTypeName);

// ----------------------------------------------------------------------------

disableSerialization;
private ["_array", "_expected", "_result", "_fn"];

_fn = "CBA_fnc_findTypeName";
Expand Down

0 comments on commit b3ec002

Please sign in to comment.