I am looking for something similar to toString
method in Scala or show
typeclass from Haskell. Example:
extends Node
class C:
var x
func _init(nx = 0):
x = nx
func _ready():
print(C.new(4))
Output:
[Reference:978]
Example of desired output (defined in class):
C(4)
Is there some standard way of doing this in GDScript*, or adhoc method is only solution?
*: For example a method which gets called by print (I failed to find documentation for print
, the search in docs is a bit weird).