Converting object to double
BlitzMax Forums/BlitzMax Programming/Converting object to double
| ||
Hi everyone, I have an object called x and a function which takes a double. Is it possible to pass a pointer to x to the function which takes a double. The function which recieves it only needs to store, and it will be passed to another function where the pointer can be cast back to object x and dereferenced like normal. Ie in C It would look like this (not sure it would work but it explains what im trying to do): char p; char *d; int t = (int) &p; d = (int*) t; *d = 1; How would I do this? |
| ||
errm in english... theres no double in the C pseudo code can you explain step by step what you mean? what type of object is x? What end result are you after there could be a more straight forward way to solve it. |
| ||
Sorry I was mullerd earlier(up all night), almost falling asleep!! I want to be able to store a pointer to any object in any other arbitary data type such as a string. I want to be able to store pointers to blitz objects in LUA and then pass them back to BlitzMax and dereference them. |
| ||
a little bit of playing resulted in this:Type TType Field val:Int End Type Global myType:TType = New TType myType.Val = 10 Local pType:TType Ptr = Varptr myType Local StringPointer:String StringPointer = String(Int(pType)) Print StringPointer Print pType[0].val 'Local ppType:Byte Ptr = Varptr pType 'ppType = Byte Ptr(StringPointeR) Local pType2:TType Ptr = TType Ptr(Int(StringPointer)) Print pType2[0].Val messy I know, but is it of any use? |
| ||
Thats great dude, Cheers! |