[Haxe][Solved] How can i extract function's signature at runtime?

Hi everyone,

Is there a way to extract a function’s parameter signature and return type?
I need this to work on all platforms (describeType works only on flash target)

for example:

function someFunction(var1:Int):Sprite{}

i need some function that will supply information that specifies var1 is of type Int and return var is Sprite.
Thanks!

The lime.system.CFFI class might help? It has a macro you could check out, that checks the signature of a function in order to populate it properly. A good starting point?

Thanks for the reply,
Could not figure out the usage of CFFI…

I actually used an annotation that compiler adds class information in compile time.
Just added @:rtti above the class definition.

than i can take the classname and get the __rtti field from it.

example:

@:rtti
class MyClass{}
trace(Reflect.getProperty(MyClass, "__rtti"));

Oh wow, that’s neat. Thanks, I hadn’t heard of that :slight_smile:

1 Like

Wait, WHAT ?!?!
@singmajesty, I think @scianid deserve a badge for that :smile:

2 Likes