Closed tabularelf closed 5 months ago
Here's the code I used for the sample project provided, if you'd like to see it directly.
show_debug_message("-1 Hello world" == -1);
show_debug_message("0 Hello world" == 0);
show_debug_message("1 Hello world" == 0);
var _str = "1 Hello world";
show_debug_message(_str == 0);
show_debug_message(_str == 1);
this is apparently working as designed but i really wish it wasn't because it makes debugging a pain in the ass
If we can't real("100000 Hello world")
into a real, then this shouldn't be true either.
In general I don't like permission interpretations of == comparisons. The number of times when you actually want it to work like that is dwarfed by the number of times when you do it by accident and spent 6 hours debugging.
This is by design due to legacy support - it'll find the first number and use that.
This is by design due to legacy support - it'll find the first number and use that.
Can the definition of "legacy support" be elaborated here? From testing:
false
, including for a == b when a = 23, b = "23"Was this part of the GMS 2.2.5 update with much-loved (not really loved) "23" - 1 ➜ 22
?
Could really use some further clarification, yeah. What "legacy" support?
It has been this way since 2.3 - others have built code that work using this... 2.3 is legacy now...
It has been this way since 2.3 - others have built code that work using this... 2.3 is legacy now...
Could it be a checkbox as it's been with "copy on write"? Neither this or "4" - 1
are documented in the manual at all, so I don't think anyone relied on this except on accident (which is arguably a good reason to remove the behaviour).
if i had to choose between not having to real()
my inputs explicitly and spending hours tracking down bugs involving strings being treated as numbers erroneously, i think i'd rather choose having to real()
my inputs explicitly
if changing it breaks any projects, it'll take like five minutes to track down the offending lines and real()
ing them explicitly
Description
There seems to be an oddity where having
"-1 Hello world" == -1
will equal to true, even though one is clearly a string and not a number.Steps To Reproduce
Which version of GameMaker are you reporting this issue for?
IDE v2024.600.0.579 Runtime v2024.600.0.605
Which operating system(s) are you seeing the problem on?
Windows 10.0.19045.0
5ef32c1f-33e8-4482-87be-4c820a8e34d8