Can’t find in list

Techno09
24 Mar 2022, 11:53

I’m trying to check if a string is in a list, but it never finds it and there’s no error message.
Puts items in list:
WE ("ad")

Function(WE):
list add (game.endings, ToString(end))

Finds item in list:
x1 = ListContains(game.endings,"ad")
x2 = ListContains(game.endings,"vibe")
if (x1 and x2) {
player.parent = Void1
}

Creation of list:
game.endings = NewStringList()

Thanks in advance!


mrangel
24 Mar 2022, 11:57

That looks like it should work.

Are you sure that you've added both items, and that they were in the list before checking?
Was the list initially set to a list? Are you sure there's no code running in between that would remove items or reset the list?


Techno09
24 Mar 2022, 11:59

Well, I did all of that. If it could help, I’ll post where I created the list.