GDScript - Functions as dictionary value

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By glr01

It’s pretty much that. I’d like to know if there’s a way to create a dictionary with a function as value, similar to what Javascript does with objects:

const obj = {
  key: () => {

If not, is there any workaround?

:bust_in_silhouette: Reply From: rakkarage
var dict := { funcref(self, "test0"): 2, funcref(self, "test1"): 1 }

That did the trick! Thank you, sir.

glr01 | 2022-02-09 21:18