Returning Types from TMap
BlitzMax Forums/BlitzMax Beginners Area/Returning Types from TMap
| ||
Ok, I have a TMap with custom types in it I want to return a type instance from the map, using ValueForKey and then run a method in the returned instance If I simply return the instance to a variable, it complains that the method doesnt exist and wont compile the program If I declair the variable to be of the same custom type, it complains that it cant convert from Object to the custom type The only way around this I can think of is to somehow get ValueForKey to return the instance as its type, instead of as an object However I've been unable to find a way to do this |
| ||
Can you cast the object back to the desired type? mytype:TType=ttype(returnedobject) |
| ||
"Unable to convert from Int to <unknown>" That makes absolutly no sense to me because I declaired everything to be the right type before hand, and there are no integers involved Edit: Dont worry I got it, I made an error implimenting your fix Ty for the help, much apreciated |