ACE3/addons/common/functions/fnc_toBitmask.sqf

24 lines
348 B
Plaintext
Raw Normal View History

/*
* Author: commy2
*
* Convert an array of booleans into a number.
*
* Argument:
* 0: Booleans (Array of Booleans)
*
* Return value:
* Bitmask (Number)
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
private ["_array", "_result"];
_array = _this;
_result = 0;
{
2015-05-14 18:06:06 +00:00
if (_x) then {_result = _result + 2 ^ _forEachIndex};
} forEach _array;
_result