Skip to content

Commit a060f1c

Browse files
committed
update to 2022-11
1 parent 988494d commit a060f1c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

current-scripts/Demos/useful-scripts/scripts/data_structures/data_structures.gml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ function array_is_subset(_a, _b) {
4040
return true;
4141
}
4242

43+
/// @func array_find(array, value)
44+
/// @desc Finds a given value in an array and returns its index, if the value doesn't exists, returns -1
45+
/// Deprecated in favour of array_find_index
46+
/// @param {Array} array
47+
/// @param {any} value
4348
function array_find(_array, _value) {
44-
var _len = array_length(_array);
45-
for (var i=0; i<_len; i++) {
46-
if (_array[i] == _value) return i;
47-
}
48-
49+
array_foreach(_array, function(_element, _i) {
50+
if (_element == _value) return _i;
51+
});
52+
4953
return -1;
5054
}
5155

current-scripts/Demos/useful-scripts/useful-scripts.yyp

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)