浏览代码

Lua: Fix Array.splice conditions for returning empty array

Justin Donaldson 9 年之前
父节点
当前提交
bc85f47c85
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      std/lua/_std/Array.hx

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

@@ -85,7 +85,7 @@ class Array<T> {
 		return haxe.ds.ArraySort.sort(this,f);
 	}
 	public function splice( pos : Int, len : Int ) : Array<T> {
-		if (pos + len > this.length || len < 0) return [];
+		if (len < 0 || pos > length) return [];
 		else if (pos < 0) pos = length -(-pos % length);
 		len = cast Math.min(len,this.length-pos);
 		var ret = [];