Check if Object is Int
BlitzMax Forums/BlitzMax Programming/Check if Object is Int
| ||
Hi, I searched the forums but couldn't find an answer to this: How do I check if an Object is an Integer? I've tried this: But that won't do the trick :P Anyone got an idea? Thanks! :D |
| ||
You would be better off creating a containing type called TInt (for example) with only one field, value:Int.Type TInt Field value:Int Function Create:TInt(i:Int) Local temp_tint:TInt = New TInt temp_tint.value = i Return temp_tint End Function End Type Global int_object:TInt = TInt.Create(5) If TInt(int_object) Then Print "Int!!!" Print int_object.value HandleToObject isn't for converting numbers to objects!!!!!!!!!!! |
| ||
Just to clarify, an object will never be an integer. In BlitzMax, numerical datatypes are not objects. |
| ||
Oh okey, Thanks for your response. I'll just have it as a String and convert it when needed :P |
| ||
I've got another one for ya! How do I convert from Object to String Array? StrArray:String[] = String[]( Obj:Object ) Doesn't seem to do it :P |
| ||
How do you declare Obj? Your question is a bit like, how do I convert a brick into an apple array? |
| ||
Gah, I found the problem. Nevermind :) |