0 votes

Hi, how to stop a running function call without using yielding and extra return statements?

On my scenario i call custom functions e.g. loaded by a external script.

To call the function i do yust instance.call(<func_name>)
But the function can take time and i want to stop it (kill) after an amount of time.
Writing the timer code is not the problem, just how to stop current exection.

Again! Please note I have no influence to the source of executed function it is a customer written code.

Second issue is to stop the function when calling a special function, without using return statements.
This is typical do by using exceptions, but i found no way or equivalence for GdScripts.

I would be very nice to give me some tricks to achive it.

Godot version godot 3x
in Engine by (47 points)

1 Answer

0 votes

In GDSript no. In C# Maybe if you run it in thread.

1. Killing function execution is not safe.
2. Thread.Abort is deprecated by Microsoft because it works only on Windows.

by (889 points)
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.