[haXe] Reflect.callMethod()
Franco Ponticelli
franco.ponticelli at gmail.com
Sun Apr 9 16:54:56 CEST 2006
Ok, now that I have understood the Reflect mechanism, I want to share a
note; if you want to call a method (not static) by name, this is not enough:
Reflect.field(ob, "methodname")();
Since the method is called but with the wrong scope (you can't access
correctly other members in methodname).
So you have to this:
Reflect.callMethod(ob, Reflect.field(ob, "methodname"), []);
Bye,
Franco.
2006/4/9, Nicolas Cannasse <ncannasse at motion-twin.com>:
>
> > Ok, that makes sense ... but what about a Reflect.callMethodByName(o,
> > methodName, args) ? Or maybe I can simply use the Reflect.field method?
>
> Exactly.
>
> Nicolas
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20060409/af63082e/attachment.htm
More information about the Haxe
mailing list