jan_flanders

Untitled

May 2nd, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import haxe.rtti.Meta;
  2. using Reflect;
  3.  
  4. class Foo
  5. {
  6.     @test
  7.     public var bar:String;
  8. }
  9.  
  10. class Main
  11. {
  12.     public static function main()
  13.     {
  14.         var meta = Meta.getFields(Foo);
  15.        
  16.         var fields = Reflect.fields(meta); //OK
  17.         for(f in fields) //OK
  18.             trace(f);
  19.        
  20.         var fields = meta.fields();//Runtime error: fields is not a function
  21.         for(f in fields) //Compiler error : You can't iterate on a Dynamic value
  22.             trace(f);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment