Skip to content
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

fix: enable proper Int/Floats parsing in the debugger watch windows on HTML5 #3328

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant