-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
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
Can't compare arrays by reference #33627
Comments
I would like a solution to this problem too. Note that dictionaries act "correctly" (imho):
prints...
I'd much prefer to see arrays work as dictionaries. Otherwise, we need some way to test whether two arrays are different arrays, as stated by OP. |
I'll look into this. Would you like this to be a change to the "==" operator or should an additional function be added to compare two arrays by reference? |
I think arrays should work like dictionaries and objects, where "==" tests identity not content. I believe we are currently lacking any way to do an identity test for arrays. I can certainly see the convenience value of one or more array (& dictionary) functions that compare content. But these should not be "==". Edit: My need for a way to test array identity is in this procedural save/load system (submitted to Godot Asset Library a few days ago). Presently, we have to work with the warning: "A single array persisted in two places will become two on load". If I could test array identity, then I could remove that warning. |
I opened a feature request to ask for ability to test array identity, whether it be |
Superseded by godotengine/godot-proposals#874. |
Godot 3.1.1
I want to compare the arrays for uniqueness. I can't do it using array comparison.
The output is:
I expect:
I want to be able to tell the difference between
test2
andtest3
as appending new values totest2
will not have them appended totest3
.i.e.
The output is:
I need a way to compare the arrays by reference. There is no way to do it (?).
In other words, how do I get the pre-"fix" #1485 results?
The text was updated successfully, but these errors were encountered: