HxGodot / hxgodot

A Haxe GDExtension for Godot 4
MIT License
232 stars 11 forks source link

Fix implicit conversions of Strings #46

Closed dazKind closed 1 year ago

dazKind commented 1 year ago
var stringName:StringName = "s"; // implicit cast String to GDString to StringName
trace(stringName == "s"); // StringName == String, These types are not compatible
trace(stringName == ("s":StringName)); // due to code-generation of implicit casts this might fail
trace(stringName == cast "s"); // check and try this, plz
trace(stringName.toString() == "s"); // doesn't crash, but is false, because:
trace(stringName.toString().length); // == 2, most likely bc of this: https://github.com/HxGodot/hxgodot/blob/main/src/godot/macros/ClassGenExtraMacros.hx#L28
trace(stringName.toString().trim() == "s"); // see above