Browse Source

Lua: fix Array remove method

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

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

@@ -77,8 +77,16 @@ class Array<T> {
 		(untyped this).splice(pos,0,x);
 	}
 
-	public inline function remove( x : T ) : Bool {
-		return untyped this.remove(x);
+	public function remove( x : T ) : Bool {
+		for (i in 0...this.length){
+			var a = this[i];
+			if (a == x){
+				lua.TableTools.remove(cast this, i+1);
+				length-=1;
+				return true;
+			}
+		}
+		return false;
 	}
 
 	public function indexOf( x : T, ?fromIndex:Int ) : Int return 1;