Is Singleton function variable shared?

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

For example I have this Singleton Script:

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

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

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.

Ertain | 2021-03-11 15:47

I see. Thanks mate!

nightrobin | 2021-03-12 14:17

:bust_in_silhouette: Reply From: Inces

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.