Browse Source

[lua] Fix String.substring

Ryusei Yamaguchi 9 years ago
parent
commit
c48ccc7b48
1 changed files with 1 additions and 1 deletions
  1. 1 1
      std/lua/_std/String.hx

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

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