浏览代码

Lua : Type.hx improvements

This fills out some of the getInstanceFields data.  It doesn't include
everything yet, I still need to add fields, etc.  There's some catches
there re: lua null behavior that I'll need to address.
Justin Donaldson 10 年之前
父节点
当前提交
1080b5062a
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      std/lua/_std/Type.hx

+ 6 - 1
std/lua/_std/Type.hx

@@ -128,8 +128,13 @@ enum ValueType {
 	}
 
 	public static function getInstanceFields( c : Class<Dynamic> ) : Array<String> {
+		var p = untyped c.prototype;
 		var a = [];
-		untyped __lua__("for i,v in pairs(c.prototype) do a:push(v) end");
+		while (p != null){
+			a = a.concat(Reflect.fields(untyped c.prototype));
+			p = untyped p.prototype;
+
+		}
 		a.remove("__class__");
 		a.remove("__properties__");
 		return a;