Skip to content

Conversation

@ninjamuffin99
Copy link
Member

@ninjamuffin99 ninjamuffin99 commented Dec 31, 2024

tldr: js was parsing ints/floats as strings, this PR makes it parse em as their proper types

Since Javascript is Javascript, on HTML5, the debug watch/tracker stuff would parse in a funny manner

lets say you had

var x:Int = 0;
var y:Int = 30;
var z:Int = 0;

// pseudocode setter
function z_setter(value:Int)
{
  x = y + z;
  return z = value;
}

and if you were to have z in a flixel debug tracker, and modify the value, it would return the new value as a string (more or less), rather than an int

so then, because javascript is javascript, if you changed the value of z in the watch window to say, 13, x would then be 3013 (x = y + z / x = 30 + 13 ==== 3013!! javascript is awesome! rather than 43 (x = 30 + 13 ===== 43!!), concatenating the number and treating it as a string, rather than forcing Int.

Seems like maybe neko ran into that issue before, since we have that in a dedicated compiler conditional around some code that ran Std.parseInt() and Std.parseFloat(). So just removing the conditional and using that functionality on all platforms seems to fix the javascript treating everything as any time at all times quirk.

I've tested on HTML5 and Mac, if Windows/Linux/Hashlink have issues, we can probably just wrap it in a #if web conditional rather than #if neko (unless we still target neko... lol)

@ninjamuffin99 ninjamuffin99 changed the title fix: enable proper Int/Floats parsing in the debugger watch on HTML5 fix: enable proper Int/Floats parsing in the debugger watch windows on HTML5 Dec 31, 2024
@ninjamuffin99
Copy link
Member Author

ninjamuffin99 commented Feb 5, 2025

small lil fixie here @Geokureli , i've been running this branch myself for a small side project and haven't run into any debugger issues

@Geokureli
Copy link
Member

Geokureli commented Feb 9, 2025

That's crazy I just made this change in another branch, let's hope there's no merge conflicts

I'm not sure why I have no recollection of this PR. Maybe I accidentally dismissed it?

@Geokureli Geokureli merged commit 9b2c998 into dev Feb 9, 2025
21 checks passed
@Geokureli Geokureli deleted the html5-debugger-fix branch February 9, 2025 01:32
@Geokureli Geokureli added this to the 6.1.0 milestone Mar 20, 2025
@Geokureli Geokureli changed the title fix: enable proper Int/Floats parsing in the debugger watch windows on HTML5 FlxG.watch: Add Float and Int parsing on all targets Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants