Browse Source

Lua: Update Type to use new __anon specification for objects

Justin Donaldson 9 years ago
parent
commit
8bb8ca5110
1 changed files with 8 additions and 5 deletions
  1. 8 5
      std/lua/_std/Type.hx

+ 8 - 5
std/lua/_std/Type.hx

@@ -131,14 +131,17 @@ enum ValueType {
 	}
 	}
 
 
 	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String> {
 	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String> {
-		var p = untyped c.prototype;
+		var p : Dynamic = untyped c.prototype;
 		var a = [];
 		var a = [];
 		while (p != null){
 		while (p != null){
-			for (f in Reflect.fields(p)) a.push(f);
-			p = untyped p.prototype;
+			var pfields : lua.Table<Int, Dynamic>  = untyped p.__fields__;
+			for (f in Reflect.fields(pfields)){
+				a.push(f);
+			}
+			var mt = lua.Lua.getmetatable(p);
+			if (mt != null && mt.__index != null ) p = mt.__index;
+			else p = null;
 		}
 		}
-		a.remove("__class__");
-		a.remove("__properties__");
 		return a;
 		return a;
 	}
 	}