Retrieving Type from TMap
BlitzMax Forums/BlitzMax Beginners Area/Retrieving Type from TMap
| ||
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 |
| ||
| I believe I need to cast ^.^ |
| ||
| nvm got it :) |
| ||
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. |