We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
let array = ["hello"]; array.index_of("hello");
EXCEPTION: Function not found: hello (&str | ImmutableString | String, i64) in call to function 'index_of' (line 2, position 7)
The text was updated successfully, but these errors were encountered:
I believe index_of takes a closure that matches items.
index_of
If you put in a string, it looks up a script function of the same name.
Thats why it is looking for a function called hello.
hello
Sorry, something went wrong.
There is an index_of that compares the passed value, only works with number
let array = [4, 5, 6, 19]; array.index_of(19);`
rhai/src/packages/array_basic.rs
Lines 823 to 833 in 169af8e
It works for all types except string, where it got mistaken as name of a function...
The versions with function names as strings are deprecated but not yet removed for fear of breaking scripts.
Therefore unfortunately the depreciated version override the standard generic version.
No branches or pull requests
The text was updated successfully, but these errors were encountered: