if hash(object) == hash(null):
print("object is null")
elif object == null:
print("object is freed object")
<Freed Object> == null returns true
OgGhostJelly | 2023-01-01 06:14
My bad, the above answer in incorrect, at least in Godot 4.x alpha. Is there a reason that said object has to be null, though? Could you instead make it start out as a string (I.e. ‘“undefined”’) and change it to and from an object that can be freed as needed and compare it to ‘“undefined”’ if needed?
SQBX | 2023-01-01 06:21
yeah that’s a good idea. I can just change the default value to “undefined” as a string, but isn’t the whole point of null to represent something that is undefined?
OgGhostJelly | 2023-01-02 03:13
Read the edited answer; TLDR I forgot hashes existed.