How to make a type Null

Blitz3D Forums/Blitz3D Programming/How to make a type Null

Picklesworth(Posted 2005) [#1]
I recall that people seem to have trouble making a Type instance be equal to Null (thus, not work so that their engine treats it as a nonexistent type... or for some other purposes that are only understood when they need to be done).
So, for some reason, many people seem to not know how to do this -- I was one of them until a minute ago.

Anyways, I was in such a situation again, and I instantly devised an ingenious solution.
vPrev.var=Object.var(0)

The type of handle 0 is nonexistent. Therefore, it is Null, and the If vPrev.var=Null thing later on will be affected by this, which means that I don't have to do a silly "IsNewVarsList" variable, which is then set back to 0 once it's been read.

So, I'm sure this has been figured out before, but I'm also sure that not everyone has figured it out, so I'll post it...


King Dave(Posted 2005) [#2]
anything.AnyType=Null ?


Stevie G(Posted 2005) [#3]
Agree with King Dave .. no bodge required!!


Damien Sturdy(Posted 2005) [#4]
Lol :)


Picklesworth(Posted 2005) [#5]
Never worked when I did that...

BLAST!


big10p(Posted 2005) [#6]
I think you might be getting mixed up with the problem of setting a function parameter to have a default of Null, which isn't possible as Null in blitz isn't a simple constant. e.g. you can't to this:

Function my_function(a.my_type=Null)
.
.
.
End Function


Picklesworth(Posted 2005) [#7]
You're right...

Further embarassment...