Reflection help!

Monkey Forums/Monkey Programming/Reflection help!

Tibit(Posted 2012) [#1]
I want to import reflection in my module.

Right now I can import the WHOLE module and I get all classes as expected.

Only alternative seems to be to import EACH of the classes involved in reflection manually.

User Code:
#REFLECTION_FILTER+="packetizerTest*"
#REFLECTION_FILTER+="amplify.testManager*"
#REFLECTION_FILTER+="amplify.methodTest|amplify.classTest|amplify.unittest"

This works, but why can't I just do:

#REFLECTION_FILTER+="amplify.testing*"

I have a file called testing.monkey importing everything in the folder /testing/

Or even better I thought the += meant I could do this inside the amplify.testManager, amplify.testing modules. All my test-framework files (that needs to be in the reflection since the user extends one of those classes and if the extended class is not in the reflection filter then so is neither the sub-class)

But how?

(Also I'd really love to see the docs improved on this, have spent way to much time debugging reflection now to no use)


Tibit(Posted 2012) [#2]
This is how I tested the reflection filter:
[monkeycode]Function TestReflectionFilter:Int()
Print "TestReflectionFilter - START"
For Local testClass:ClassInfo = EachIn GetClasses()
Print testClass.Name
Next
Print "TestReflectionFilter - END"
End[/monkeycode]


Tibit(Posted 2012) [#3]
It seems like the reflection filter works different depending on from where it it called.

This:
#REFLECTION_FILTER+="network*"
#REFLECTION_FILTER+="testing*"

Works if the main file is inside the module.