Reflection Issue

Monkey Forums/Monkey Programming/Reflection Issue

Raz(Posted 2012) [#1]
I'm pretty sure I had this working a couple of months ago but not I get the following error

Monkey Runtime Error : Object reference not set to an instance of an object.


I am loading data from a text file. And in the code below item[2] is "0".

[monkeycode]Print "Settings "+name+" to "+Int(item[2])
cInfo.GetGlobal(name,false).SetValue(BoxInt(Int(item[2])))[/monkeycode]

The print line of code is generating the following before the SetValue line (which is causing the error).

Settings src.appstate.AS.totalCollectedCoins to 0


AS is a static class I use to store global variables. It is situated in the src.appstate.monkey file. totalCollectedCoins is a global variable within the AS class.

Saving the file using reflection works fine.

Any tips?

ta :)


Raz(Posted 2012) [#2]
Huh... I got rid of the "src.appstate." part when declaring which value I wanted to set and it worked. I swear it was required before :o Never mind :)