Browse Source

[lua] fix unshift for empty array

Justin Donaldson 8 years ago
parent
commit
cb959daa4f
1 changed files with 1 additions and 0 deletions
  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];