Explorar o código

Lua: Update Type to use new __anon specification for objects

Justin Donaldson %!s(int64=9) %!d(string=hai) anos
pai
achega
8bb8ca5110
Modificáronse 1 ficheiros con 8 adicións e 5 borrados
  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> {
-		var p = untyped c.prototype;
+		var p : Dynamic = untyped c.prototype;
 		var a = [];
 		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;
 	}