浏览代码

[lua] fix unshift for empty array

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

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

@@ -131,6 +131,7 @@ class Array<T> {
 	}
 
 	public function unshift( x : T ) : Void {
+		if (this.length == 0) this[0] = x;
 		lua.Table.insert(untyped this, 1, x);
 		var tmp = this[0];
 		this[0] = this[1];