+4 votes

Hi all,

I have a function called woodenBoardPlay that accepts two inputs.

so the function looks a bit like:

func woodenBoardPlay(direction, message):

In my timer's timeout, I want to call that function like so:

sunkTimer.connect("timeout",self,woodenBoardPlay("down", "youLost"))

It gives this error though:
Invalid type in function 'connect' in base 'Timer'. Cannot convert argument 3 from Nil to String.

How can I pass variables to a function like I'm trying to? I am officially stumped! :-)

in Engine by (838 points)

1 Answer

+5 votes
Best answer

Like this:

sunkTimer.connect("timeout",self,"woodenBoardPlay",["down", "youLost"])
by (470 points)
selected by

Thank you. That's appreciated. This is where these QA forums will help in the future. There are so many little things like this to learn and I just can't find anywhere else to get that kind of info. It's very helpful. Thanks again.

Thanks aozasori ! I was trying to understand the argument into the connect function.

 Array binds=Array(),
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.