开发者

haxe: Indirect property referencing

I might be missing something obvious, but how do I reference a property indirectly? E.g in javascript it would be:

 if(propName in obj) return obj[propName];

How to say the same in开发者_如何学Python haxe? The object in question is Dynamic<String>, flash.display.LoaderInfo.parameters to be specific.

Many thanks.


if(Reflect.hasField(obj, propName)) return Reflect.field(obj, propName);

Althought it seems more code, the generated output is basically the same.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜