Array Function CBA_fnc_findMin is broken. #257

Closed
Sergeant-Rock opened this Issue Feb 7, 2016 · 5 comments

Projects

None yet

4 participants

@Sergeant-Rock

In the function the variable _max need to be replaced with _min. I think this may havbe resulted from a copy/paste error with CBA_fnc_findMax. Simple fix.

I've highlighted in the current function the issues:

include "script_component.hpp"

SCRIPT(findMin);

private ["_index"];

if (!IS_ARRAY(_this)) exitWith {nil};
if (_this isEqualTo []) exitWith {nil};

params ["_min"];
_index = 0;

{
if (isNil "_x" || {(typeName _x) != (typeName 0)}) exitWith {_max = nil; _index = nil;};
if (_min > _x) then {_min = _x; _index = _forEachIndex};
} forEach _this;

if (isNil "_max") exitWith {nil};
[_min, _index] // Return

@Sergeant-Rock

Great, I take it this will be in the next release? Thx.

@jonpas
Contributor
jonpas commented Feb 7, 2016

Yes it will be.

@commy2 commy2 added the bug label Feb 7, 2016
@commy2 commy2 added this to the 2.3 milestone Feb 7, 2016
@commy2 commy2 self-assigned this Feb 7, 2016
@commy2
Contributor
commy2 commented Feb 7, 2016

Close, because already fixed.

@commy2 commy2 closed this Feb 7, 2016
@commy2
Contributor
commy2 commented Feb 7, 2016

ref: #207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment