[Solved] Return list item count and higher index.

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

Hello.

I am using Godot as a live presentation tool. It works quite well, but my script only goes forward and backwards, now I want to refine it a little so it handles exiting and the end of animation_list.

After get_animation_list(), I need to know how many animations there are inside (getting the highest index would be equally helpful)

I suppose there’s a built-in method to do so, but I haven’t found it yet. Any advice?

Thanks. :smiley:

:bust_in_silhouette: Reply From: eska

get_animation_list() returns a StringArray, you can simply call size() on it:

var number_of_animations = my_animation_player.get_animation_list().size()
var last_index = number_of_animations - 1

Excelent. I completely forgot about that, I feel kind of dumb now. :'v

Where can I find a list to those calls you can make on objects? like size(), I know 2 or 3 more. Where can I find them listed?

Marking this as solved. Thanks for your reply. :smiley:

rredesigns | 2016-07-04 23:42

At the top of the script editor there are two buttons, “Classes” and “Search Help”:

Class reference buttons

“Classes” brings up a (searchable) list of all classes. Double click one to see a list of its methods and constants.

“Search Help” lets you search for classes, functions and constants.

You can also read the same reference in Godot’s online documentation: All classes — Godot Engine (latest) documentation in English

eska | 2016-07-05 00:07