Serializing instances

Monkey Forums/Monkey Programming/Serializing instances

Raz(Posted 2011) [#1]
Hi all,

is it possible to serialize an instance of an unknown class, that is a class where I don't specifically know which fields it has.

Ta!
-Chris


therevills(Posted 2011) [#2]
You would need reflection for that and Monkey doesnt support reflection.


Raz(Posted 2011) [#3]
Got ya, thank you.


slenkar(Posted 2011) [#4]
you could write a program in blitzmax to read the monkey file,

It would create a method for your class called ToString

Blitzmax reads the fields of your class and writes the method to the monkey file

I was going to do this myself but havent had a need yet.


Suco-X(Posted 2011) [#5]
I have seen a reflection modul some updates ago. So I think Mark is still working on it.

Mfg Suco


slenkar(Posted 2011) [#6]
i had a look at the reflection module and its the framework for saving and writing strings to xml basically, you still have to write the code for each individual field.


Samah(Posted 2011) [#7]
i had a look at the reflection module and its the framework for saving and writing strings to xml basically, you still have to write the code for each individual field.

If you're talking about the serialization module in diddy, unfortunately that's the only way I could make things serializable. If Mark adds reflection, I'll change it.


slenkar(Posted 2011) [#8]
still useful though, if i eventually make that blitzmax program