0 votes

For example I have this Singleton Script:

func displayer(int B):
var A = B
...a long processing code...
print(A)

Will the value of A not be consistent if the function is still running and another call this function too?

Godot version 3.2.3
in Engine by (40 points)

When one script calls the function, it passes data that's related to that script. When another script passes data to the function, it passes data from that second script. It is a scope issue. Unless the first script is changing a public variable in the singleton, the second script won't have the same results.

I see. Thanks mate!

1 Answer

+1 vote
Best answer

This is in-function variable. Every time function is called it will print new A variable based on passed B. You shouldn't be worried about causing stack overflow with multiple calls in similar time, I don't think its even possible, at worst You will get an error that function wasn't able to process some calls.

by (8,099 points)
selected by
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.