godotengine/awesome-godot

It's this a bug or a feature? gdScript if condition operation

yoyopinkman opened this issue · 1 comments

when use if , if not operation to test a condition is true or false;
if operate on zero value of every Variant type it will be false, if not operate on zero value of every Variant type it will be true,
so fa so good, it's cool;
but when i use to test a freed Object; if, if not two opreate both true, it confuse me

code like this:
....
var instance = cell.instantiate()
instance.free()
if instance:
print("cell is true:", instance)
if not instance:
print("cell is not true:", instance)
...
this two condition test will all execute
by the way, i know the has a funciton "is_instance_valid" use to test a instance

sorry, i should put this to Godot project