Explorar o código

Lua : fix String.indexOf

Justin Donaldson %!s(int64=9) %!d(string=hai) anos
pai
achega
c2cd70f0b4
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      std/lua/_std/String.hx

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

@@ -50,7 +50,8 @@ class String {
 		if (startIndex == null) startIndex = 1;
 		else startIndex += 1;
 		var r = lua.StringTools.find(this, str, startIndex, true);
-		return untyped r && (r - 1) || (-1);
+		if (r != null && r > 0) return r-1;
+		else return -1;
 	}
 
 	public function lastIndexOf( str : String, ?startIndex : Int ) : Int {