Page 1 of 1

Can RemoveItem affect item 0?

Posted: Fri Jan 29, 2016 10:23 am
by Bugala
I am having a bug which makes no sense.

Idea is that to have my items in list in right order, I am adding "empty" item to list location 0, since otherwise the first item (0) would be executed first. However, this "empty" item is there only temporary and is removed after the loop:

Code: Select all

Insertitem(t_table, "empty", 0)

foreach(t_table, Function (cell, data)
if cell = "empty" then return
other stuff to be done
endfunction )

removeitem(t_table, 0)
Now problem is, some strange way this "empty" ends up staying there in one case causing a crash bug, and i cant really figure out what is causing this.

So far only line that has anything to do with tables inside that function seems to be that I am using RemoveItem for t_tables items that are greater than 0 in some cases.

Therefore, is there any possibility that when for example item number 2 would be removed using RemoveItem, that Item number 0 would change its spot to some other number location?

Re: Can RemoveItem affect item 0?

Posted: Mon Feb 01, 2016 7:41 pm
by airsoftsoftwair
Item 0 could only change its position in the list if another item is inserted in front of it. RemoveItem() should never affect item 0.... unless you explicitly specify 0 as the parameter :)

Re: Can RemoveItem affect item 0?

Posted: Mon Feb 01, 2016 11:26 pm
by Bugala
And just to comfirm, only way to affect item 0 with insertitem would be to use
Insertitem(table, item, 0), right?
that just insertitem(table, item) would never affect item in location 0?

Re: Can RemoveItem affect item 0?

Posted: Tue Feb 02, 2016 2:52 pm
by airsoftsoftwair
Yes.