#[Solved] Question regarding Callables (Godot 4.1.2)

8 messages · Page 1 of 1 (latest)

frosty glade
#

As per the screenshots, I did the correct syntax/way of how it's documented, and yet _callable still returns null.
Nothing I do returns a Callable type. Even in multiple tests/ways, it still didn't work.

Did I do it correctly? Or is Callable bugged? I want to know before I open up an issue.

rare ingot
#
extends Node


const ACTION_QUEUE := [
    "hello"
]
const SOME_MESSAGE := "world!"

func _ready() -> void:
    var _callable: Callable
    _callable = Callable(self, ACTION_QUEUE[0])
    _callable.call(SOME_MESSAGE)


func hello(message: String) -> void:
    print("hello %s" % [message])
#

works fine here

frosty glade
#

That's..... interesting.
Solely because I did var _callable: Callable = Callable(self, "func") standalone before and it gave me null.

The array doesn't have an issue either, huh.
Let me take another look.

#

Yeah, this is really weird.
Unless I messed up somehow somewhere.
It wouldn't stop giving me nulls, and it doesn't call the function either.

rare ingot
#

you can't do "func" for a function name, because it's a GDScript keyword, so that's to be expected

#

I'd double check your function names, and double check that the functions in your queue actually exist

frosty glade
#

Perhaps, though I think I found the issue.
Thank you for confirming, regardless!
(For context, the issue was me inserting the wrong arguments lmao)