浏览代码

Lua: Update Type to use new __anon specification for objects

Justin Donaldson 9 年之前
父节点
当前提交
8bb8ca5110
共有 1 个文件被更改,包括 8 次插入5 次删除
  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;
 	}