So the function as seen at http://www.creationkit.com/GetAt_-_FormList
int Function GetFormIndex(FormList List, Form Member) global
{Gets the index of Member in List. Returns -1 if not found}
if (!List.HasForm(Member))
Return -1
endif
int Index = 0
While (List.GetAt(Index) != Member)
Index += 1
EndWhile
Return Index
EndFunction
{Gets the index of Member in List. Returns -1 if not found}
if (!List.HasForm(Member))
Return -1
endif
int Index = 0
While (List.GetAt(Index) != Member)
Index += 1
EndWhile
Return Index
EndFunction
I was using it with ObjectReferences and I'm 100% sure the object is in the list and at index 0 in my test. It passes the HasForm check thous not returning -1 but the while condition is never met.
Not working either: List.GetAt(Index) as ObjectReference != Member as ObjectReference
Working: List.GetAt(Index).GetFormID() != Member.GetFormID()
So please help in figuring what the *** happens in the example, not by trying to provide alternative solutions that will avoid completely that condition check.
Another side issue of the bug in the given example is that the index will go over the list size and continue without an error. Again, I know how to change the function to avoid that...but what's the gain if the index is not found if it should be. I'm curious here just if someone tested and is really an endless loop or it will stop somehow at an absolute max size of the form lists or something.
Thanks