Change example code to properly represent test cases with refcounted objects

This commit is contained in:
Bastiaan Olij
2022-12-05 22:04:08 +11:00
parent 32859ea25c
commit f24ee56c5d
4 changed files with 46 additions and 8 deletions

View File

@@ -28,7 +28,10 @@ func _ready():
($Example as Example).simple_const_func() # Force use of ptrcall
prints(" returned", $Example.return_something("some string"))
prints(" returned const", $Example.return_something_const())
prints(" returned ref", $Example.return_extended_ref())
var null_ref = $Example.return_empty_ref()
prints(" returned empty ref", null_ref)
var ret_ref = $Example.return_extended_ref()
prints(" returned ref", ret_ref.get_instance_id(), ", id:", ret_ref.get_id())
prints(" returned ", $Example.get_v4())
prints("VarArg method calls")

View File

@@ -3,13 +3,15 @@
[ext_resource type="Script" path="res://main.gd" id="1_c326s"]
[node name="Node" type="Node"]
script = ExtResource( "1_c326s" )
script = ExtResource("1_c326s")
[node name="Example" type="Example" parent="."]
[node name="ExampleMin" type="ExampleMin" parent="Example"]
layout_mode = 0
[node name="Label" type="Label" parent="Example"]
layout_mode = 0
offset_left = 194.0
offset_top = -2.0
offset_right = 234.0