ECMAScript icon indicating copy to clipboard operation
ECMAScript copied to clipboard

Not an issue but a general question

Open anatoli-dp opened this issue 2 years ago • 1 comments

As it is i much prefer javascript over gdscript however would like to get one thing sorted before trying out this package . . . what happens if i use a custom module? I am currenty using zylan voxel module in my game and want to be able to program in javascript but am unsure if the api would also be available or is it strictly the api that godot comes with natively? Does this project use some sort of reflection allowing different modules to still be used and called upon or is this a nogo for that?

anatoli-dp avatar Apr 21 '22 05:04 anatoli-dp

I didn't test the voxel module, but in general, it is possible to use GDScript and JS/TS.

I have an example with a GDScript and TS file.

The important thing would be that you use new() to instantiate and call to execute the function:

import Bla from "res://scripts/gd/Bla.gd";
...
const bla: Bla = Bla.new();
bla.call("run_in_bla");

Another way would be to use a signal with some "connection" GDScript or you can try it with a auto-load sigleton

nmerget avatar Oct 10 '23 19:10 nmerget