How do I get the index number of an item in an array?
-
I never would've thought I would be in the help section, but here I am, Is there a way to get the index number of an array? I know how to do it the "long way" with my own function and everything, but most programming languages have something like that . I know there are tons of secrets that are not on the help section such as getting the letter at a specific index inside a string (string[index]), so I am wondering if there is something like that on fuze too.
-
I'm not aware of any built-in way to do that. For most array processing functions, if you want them, it's up to you to code them.
It's not directly related to your question, but one trick I've found that can be useful in some circumstances, particularly when dealing with structs, is to convert the array/struct into a string using str() and then process it with the string functions. It's particularly relevant to structs because it allows you to search for a field within the struct, which can't normally be done. The limitation on this, though, is that str() will throw an error if the struct contains anything such as a handle that can't be converted to a string.