Hello,
Basically I want to do the same thing as how Node.get_node(NodePath path)
allows String
as an argument.
I want to allow my custom method to take arguments that are different from the expected arguments, but are convertible. (Since method overloading is not supported.)
Ultimately, what I'm hoping to do is, to allow:
Logger.warn("Error loading file!")
# instead of:
#Logger.warn(LogMsg.new("Error loading file!"))
When it's expecting:
# Logger
func warn(m:LogMsg):
push_warning(m.compose("WARNING"))
# LogMsg
func _init(message:String):
_message = message
Is there any way this is possible?
Thanks.