-
-
Notifications
You must be signed in to change notification settings - Fork 549
Open
Labels
BUGSomething isn't workingSomething isn't working
Milestone
Description
Make sure you're on the latest stable or beta build
- I have tested this on the latest stable or beta release
Is this a bug in companion itself or a module?
- I believe this to be a bug in companion and not a specific module
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
arrayLastIndexOf( val, find, offset ) seems to be searching backwards from index 0 by default, rather than the end of the array. I have to set the offset to length(array) to have it actually search from the end.
Steps To Reproduce
- In an expression, set up an array with two of the same value
- Pass it to arrayLastIndexOf()
array = [1,1,1]
arrayLastIndexOf(array, 1) - See that it returns 0 only if the find value is in index 0, and -1 in all other cases
Expected Behavior
The function finds the index of the last occurrence of a value within the provided array without needing to specify the end of the array as the starting index.
Environment (please complete the following information)
- OS: Win 11 23H2
- Browser: Edge 143
- Companion Version: 4.2.2Additional context
The documentation for arrayLastIndexOf() does specify that "The beginning is position 0", which seems to be true.
However, the documentation for lastIndexOf() also says this and that function does not share this behavior.
Metadata
Metadata
Assignees
Labels
BUGSomething isn't workingSomething isn't working
Type
Projects
Status
Done