-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
StringName comparisons give wrong and inconsistent results #76218
Comments
The documentation is apparently wrong from the implementation, should be updated |
The operator is implemented like this godot/core/string/string_name.h Lines 117 to 119 in 06f5b09
_data is a pointer. It's wrongly implemented (unless there is a reason why it's like that).
|
Internally |
I assume |
In fact the wording for
|
The implementation is weird though as it doesn't give correct results, also there isn't any other comparison operators for |
For now if you want the alphabetic ordering a workaround should be to cast them to I suspect there's some conversion going on as there's no errors caused by the fact that |
Working on a fix for this |
Godot version
4.0.2
System information
Linux 5.10.167-2-MANJARO
Issue description
Comparing StringNames will give wrong and inconsistent results, running the provided code will give the results:
The documentation for
<
onStringName
says:However then "a < b" should be true, not false.
In addition
a <= b
andb <= a
is true, yeta == b
is false. Which is inconsistent.Steps to reproduce
run
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: