Browse Source

[lua] fix unshift again

Justin Donaldson 8 years ago
parent
commit
d9ddd18d98
1 changed files with 4 additions and 1 deletions
  1. 4 1
      std/lua/_std/Array.hx

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

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