Neptune
Member
I think I'm just having a brain cramp with some code, but is this proper thinking?
I want to scan through the list. If an entry is == 3, I'd like to delete the index at 'i' and 'i-1', and then continue scanning with what would have been the next entry...
I want to scan through the list. If an entry is == 3, I'd like to delete the index at 'i' and 'i-1', and then continue scanning with what would have been the next entry...
Code:
var list = ds_list_create();
ds_list_add(list,1);
ds_list_add(list,2);
ds_list_add(list,3);
ds_list_add(list,4);
for(var i = 0; i < ds_list_size(list); i++)
{
if list[| i] == 3
{
repeat(2)
{
ds_list_delete(list,i-1);
}
i -= 2;
if ds_list_empty(list)
{
break;
}
}
}
/*
At this point, I think the list would contain:
list[| 0] == 1
list[| 1] == 4
*/