List and conversion
BlitzMax Forums/BlitzMax Beginners Area/List and conversion
| ||
i've filled a list by splitting a string, now i need to fill the fields of my object but i've some problems:Type tUser Field Id:Int Field Email:String Field Pass:String Field Nick:String Field SystemID:Int Method fillUser() id = SplitDataList.ValueAtIndex(0).toInt() Email = SplitDataList.ValueAtIndex(1).toString() .... End Method End Type i'm using the .toString and .toInt 'cause i got error "cannot converto from Object to String" so i've worked around on this way. the problem is about .toInt, 'cause i got the error "Identifier 'toInt' not found" :-\ i've made something wrong ? ** edit by building w/out strict it works fine, but i wish to know what's wrong |
| ||
Method fillUser() id = SplitDataList.ValueAtIndex(0).toInt() Email = SplitDataList.ValueAtIndex(1).toString() .... End Method Method fillUser() local obj:tuser=Tuser(SplitDataList.ValueAtIndex(0)) id = obj.id Email = obj.email End Method With ValueAtIndex() you get the 'object' in the list. You need to cast (convert) to your type and the access the fields. |
| ||
thnx alot ^^ at cast string ->to-> int looks works too id = String(SplitDataList.ValueAtIndex(0)).toInt() ;-) |