Retrieving Type from TMap

BlitzMax Forums/BlitzMax Beginners Area/Retrieving Type from TMap

BLaBZ(Posted 2010) [#1]
I've inserted my type into a Map using...

owner.DataPort.Insert("TCursorDefault", Self)


How would I go about retrieving that object?

ValueForKey Returns Object, but I need the class instance I inserted


BLaBZ(Posted 2010) [#2]
I believe I need to cast ^.^


BLaBZ(Posted 2010) [#3]
nvm got it :)


Czar Flavius(Posted 2010) [#4]
Unless you are 100% sure the type you are getting out is that, you should do a check like this whenever you transform an object into a type..

Local o:MyType = MyType(map.ValueForKey("blah"))
If (Not o) Then ..Error..


If you get SomeOtherType out of the map, it will get converted to Null during the cast to MyType.