Browse Source

Lua: Fix bug in Array.shift

Justin Donaldson 9 years ago
parent
commit
f798535009
1 changed files with 2 additions and 1 deletions
  1. 2 1
      std/lua/_std/Array.hx

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

@@ -63,9 +63,10 @@ class Array<T> {
 	public function shift() : Null<T> {
 	public function shift() : Null<T> {
 		if (this.length == 0) return null;
 		if (this.length == 0) return null;
 		var ret = this[0];
 		var ret = this[0];
-		for (i in 1...length){
+		for (i in 0...length){
 			this[i] = this[i+1];
 			this[i] = this[i+1];
 		}
 		}
+		this.length-=1;
 		return ret;
 		return ret;
 	}
 	}
 	public function slice( pos : Int, ?end : Int ) : Array<T> {
 	public function slice( pos : Int, ?end : Int ) : Array<T> {