[GDScript][answered] testing snippets without the IDE

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jeangit
:warning: Old Version Published before Godot 3 was released.

Hello,

I’ve tried to use the possibilities of godot -s script.gd , for writting tests without setting up a project and messing with the editor.

It seems to work, except the fact that i’d like to exit the main loop of Godot after the script has runned.

So for the moment , the best i could (with the help of IRC people) do is thac:

extends MainLoop

func _initialize():
  print("It works... but doesn't quit")
  finish() #does nothing

The script is run with godot -s from the shell, but keeps running after the print.
Do you have any idea for exiting cleanly ? Thank you.

Extending SceneTree instead of MainLoop works with quit(), and finish() throws a segfault, something may be wrong with that method.

eons | 2017-03-02 14:15

eons, it works perfectly with quit().
Thank you!

jeangit | 2017-03-02 14:55

:bust_in_silhouette: Reply From: eska

If you’re using MainLoop as base class, return true from the _iteration(delta) callback to quit.