bbbower
Member
I've simplified my code example. Basically without using a for loop... I was trying to use ds_list_find_index to determine if a pair of coordinates were already inside the ds_list so that duplicates did not get added.
Gamemaker says that values inside of a ds_list can be an array. However it is unable to check them even if they are already in the list ds_list_find_index still returns -1 and duplicates continue to be added.
Is this a bug or am I overlooking something here?
My conclusion is that you cannot directly check array values using this function but again.. the function help states the value checking can be an array.
Example : coords 1,1 get added to list, ds_list_find_index checks for coords[1,1] , its in the list already, but -1 is returned anyway and then 1,1 gets added a second time.
Gamemaker says that values inside of a ds_list can be an array. However it is unable to check them even if they are already in the list ds_list_find_index still returns -1 and duplicates continue to be added.
Is this a bug or am I overlooking something here?
My conclusion is that you cannot directly check array values using this function but again.. the function help states the value checking can be an array.
Example : coords 1,1 get added to list, ds_list_find_index checks for coords[1,1] , its in the list already, but -1 is returned anyway and then 1,1 gets added a second time.
Code:
var coords;
coords[0] = ex; // The x value of the item being added for removal
coords[1] = ey; // The y value of the item being added for removal
if (ds_list_find_index(list_remove,coords) > -1) {
show_debug_message("Duplicate Remove @ " + string(coords));
exit;
}
ds_list_add(list_remove,coords);