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

[lua] Fix String.substring

Ryusei Yamaguchi 9 жил өмнө
parent
commit
c48ccc7b48

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

@@ -99,7 +99,7 @@ class String {
 		if (endIndex == null) endIndex = this.length;
 		if (endIndex == null) endIndex = this.length;
 		if (endIndex < 0) endIndex = 0;
 		if (endIndex < 0) endIndex = 0;
 		if (startIndex < 0) startIndex = 0;
 		if (startIndex < 0) startIndex = 0;
-		if (endIndex == 0) {
+		if (endIndex < startIndex) {
 			// swap the index positions
 			// swap the index positions
 			return NativeStringTools.sub(this, endIndex+1, startIndex);
 			return NativeStringTools.sub(this, endIndex+1, startIndex);
 		} else {
 		} else {