eastern-flames/eastern flames/scripts/array_find_index/array_find_index.gml

11 lines
223 B
Plaintext
Raw Permalink Normal View History

2022-08-07 21:14:04 +00:00
function array_find_index(array, val, repititionof=1) {
var i;
var amountof = 0;
for (i=0; i<array_length(array); i++) {
if array[i] == val {
amountof++;
if amountof >= repititionof return i;
}
}
return -1;
}