2
0
Эх сурвалжийг харах

Fix Issue3742 (strings staring with `.` are valid for tonumber ; zeroMatch removed)

peyty 9 жил өмнө
parent
commit
ea0b04b455
1 өөрчлөгдсөн 1 нэмэгдсэн , 2 устгасан
  1. 1 2
      std/lua/_std/Std.hx

+ 1 - 2
std/lua/_std/Std.hx

@@ -58,8 +58,7 @@ import lua.Boot;
 
 	public static function parseFloat( x : String ) : Float {
 		if (x == null || x == "") return Math.NaN;
-		var zeroMatch = lua.StringTools.match(x,  "^ *[%-+]?0");
-		var digitMatch = lua.StringTools.match(x,  "^ *[%-+]?[0-9]%d*");
+		var digitMatch = lua.StringTools.match(x,  "^ *[%.%-+]?[0-9]%d*");
 		if (digitMatch == null){
 			return Math.NaN;
 		}