Search code examples
haxe

Understanding the behavior of Reflect.fields on cpp target


can you help me with understanding the behavior of Reflect.fields?

I have this code:

var obj:Dynamic={arr:["aaa","bbb","ccc"]};
trace(Reflect.fields(obj));
trace(Reflect.fields(obj.arr));

JS target output:

[arr]
[0,1,2]

CPP target output (Android NDK):

[arr]
[]

Why CPP target didn't return [0,1,2]?


Solution

  • As mentioned in the API documentation on Reflect.fields()

    This method is only guaranteed to work on anonymous structures.

    So the behavior on array is not specified.