Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Address-of-a-variable/GDScript/address-of-a-variable.gd
Normal file
27
Task/Address-of-a-variable/GDScript/address-of-a-variable.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
extends MainLoop
|
||||
|
||||
|
||||
func _process(_delta: float) -> bool:
|
||||
var a := Node.new()
|
||||
var b := Node.new()
|
||||
|
||||
# a and b are different objects with different RIDs
|
||||
print(a.get_instance_id())
|
||||
print(b.get_instance_id())
|
||||
|
||||
assert(a != b)
|
||||
assert(a.get_instance_id() != b.get_instance_id())
|
||||
|
||||
# Set b to refer to the same object as a
|
||||
b.free()
|
||||
b = a
|
||||
|
||||
# a and b are now the same object and have the same RID
|
||||
print(a.get_instance_id())
|
||||
print(b.get_instance_id())
|
||||
|
||||
assert(a == b)
|
||||
assert(a.get_instance_id() == b.get_instance_id())
|
||||
|
||||
a.free()
|
||||
return true # Exit
|
||||
Loading…
Add table
Add a link
Reference in a new issue