浏览代码

[lua] Fix String.substring

Ryusei Yamaguchi 9 年之前
父节点
当前提交
c48ccc7b48
共有 1 个文件被更改,包括 1 次插入1 次删除
  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 {