Browse Source

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 năm trước cách đây
mục cha
commit
1080b5062a
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  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;