itemList node - How do you get the index of the currently selected item?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By blurymind
:warning: Old Version Published before Godot 3 was released.

I mean honesty…

There is nothing about this in the documentation and no function or method to get that index! There are no tutorials anywhere about it either. Such a simple thing, why is it so hidden in godot?

Please help

:bust_in_silhouette: Reply From: blurymind

ah nevermind. I figured it out. You have to connect the itemList to the node with the script.
Then you get this function

func _on_ItemList_item_selected( index ):
print (index)

:bust_in_silhouette: Reply From: DimitriyPS

Oh my God… in the “ItemList” not built-in method returns the index of the selected item?!!.. This is a cruel joke?

I get it is weird. But this is not an answer, you should add it as a comment.

vnen | 2016-06-28 14:31