mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 19:29:06 +00:00
rework two funcref code examples (#6542)
Co-authored-by: Max Hilbrunner <mhilbrunner@users.noreply.github.com>
This commit is contained in:
co-authored by
Max Hilbrunner
parent
4fa13df80f
commit
88e02928f3
@@ -478,7 +478,7 @@ accesses:
|
||||
|
||||
func my_method():
|
||||
if fn:
|
||||
fn.call_func()
|
||||
fn.call()
|
||||
|
||||
# parent.gd
|
||||
extends Node
|
||||
@@ -486,7 +486,7 @@ accesses:
|
||||
@onready var child = $Child
|
||||
|
||||
func _ready():
|
||||
child.fn = funcref(self, "print_me")
|
||||
child.fn = print_me
|
||||
child.my_method()
|
||||
|
||||
func print_me():
|
||||
|
||||
@@ -98,10 +98,10 @@ initialize it:
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
# Parent
|
||||
$Child.func_property = funcref(object_with_method, "method_on_the_object")
|
||||
$Child.func_property = object_with_method.method_on_the_object
|
||||
|
||||
# Child
|
||||
func_property.call_func() # Call parent-defined method (can come from anywhere).
|
||||
func_property.call() # Call parent-defined method (can come from anywhere).
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user