object command ?
BlitzMax Forums/BlitzMax Beginners Area/object command ?
| ||
well I cant find any documentation in blitz3d for it but some of the code im porting uses the object command like the following: Anon.AnonInst = Object.AnonInst(Int(Split$(Params$, 1, ","))) I cant seem to figure out what Object is and what it would translate to in bmax any help would be great. |
| ||
could still use some help on this one. |
| ||
Object is the base type, all other types inherit from it. |
| ||
Yeah. Everything but numbers, which sucks because that screws up fake overloading. |
| ||
ok so what would I do in order to port that bit over to bmax? |
| ||
What is this code meant to do at all, as it isn't B3D / BB+ code... |
| ||
the object command returns the object associated with a handle (retrieved with the handle command). They are undocumented but have become commonly used. |
| ||
I should probably apologise for this in advance... |
| ||
at risk of sounding stupid could you explain that ^^ ? |
| ||
ah that kind of stuff ... ok objects are by ref in BM. For their "int handles" you can convert them into byteptr for example and get the object of that later again. |
| ||
TwoEyedPete Im afraid I dont quite understand exactly what your trying to tell me with that code example could you explain it or comment it please? |
| ||
ok so after emailing blitz research they were kind enough to give me a work around: Extern Function bbHandleToObject:Object( handle ) Function bbHandleFromObject( obj:Object ) End Extern Type MyType Field x=1234 End Type Local t:MyType=New MyType Local h=bbHandleFromObject( t ) Local p:MyType=MyType( bbHandleToObject(h) ) Print p.x Now Ive encorperated that into my code and it works but I need to do the following: Blitz3d Actor.ActorInstance = Object.ActorInstance(Int(SafeSplit$(Params$, 1, ","))) now in Blitzmax I have this: Actor:bbActorInstance = bbActorInstance(bbHandleToObject(A)) but I cannot figure out how to still use Int(SafeSplit$(Params$, 1, ",")) Any suggestions would be great thanks |
| ||
Eh?...I could have sworn I'd replied to this thread ages ago??? 8o/ I don't really understand what you're asking? You should be able to just use the same code... Actor:bbActorInstance = bbActorInstance(bbHandleToObject(Int(SafeSplit$(Params$, 1, ",")))) |
| ||
well I'll give it a shot but im not sure. Ok looks like it might have worked... thanks |
| ||
Don't forget to release your handles. |