Files
DayZ-Epoch/SQF/dayz_code/compile/fn_deleteAt.sqf
worldwidesorrow 01c2c3eba2 Add files via upload
New functions.
2020-07-14 15:58:04 -05:00

21 lines
508 B
Plaintext

/*
Description: Removes the desired element from an array regardless of data type.
Usage: array = [array, index] call fnc_deleteAt;
Made for DayZ Epoch by JasonTM
*/
private ["_arr","_idx","_cnt"];
_arr = _this select 0;
_idx = _this select 1;
_cnt = (count _arr) - 1;
if (_idx > _cnt || {_idx < 0}) exitWith {
diag_log "[fnc_deleteAt] Error: out of bounds index provided!";
_arr
};
for "_i" from _idx to _cnt do {
_arr set [_i, (_arr select (_i + 1))];
};
_arr resize _cnt;
_arr