eastern-flames/eastern flames/scripts/array_front/array_front.gml

18 lines
410 B
Plaintext
Raw Normal View History

2022-08-07 21:14:04 +00:00
function array_front(array, val) {
var returnable = false;
var test;
var i;
for (i=0; i<array_length(array); i++) {
if array[i] == val {
test = array[i];
array_delete(array, i, 1);
array_insert(array, 0, test);
returnable = true;
}
}
/*do {
test = [];
array_copy(test, 0, array, movedcount, array_length(array)-movedcount);
} until !array_contains(test, val);*/
return returnable;
}