Running GDScript ideas in CLI is faster than using this GDScript playground, and also the above playground is not using the latest version of Godot.
$ ./new -r hello-world
This automatically generates and opens the file scripts/hello-world.gd
, whereafter _init()
has been implemented:
extends Node
func _init() -> void:
print("hello world")
func _ready() -> void:
queue_free()
# vim:et:ts=4:sts=4:sw=4
Saving and exiting the editor automatically runs the script:
> Godot Engine v4.0.stable.mono.official.92bee43ad - https://godotengine.org
>
> hello world
You can also manually invoke any script previously created:
$ ./run hello-world
Scripts are saved to a scripts/
directory. You should only use the basename of the script, and you
can omit the .gd
file extension.
- Godot 4
godot4
executable inPATH
pointed at the above