![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Nobel |
So I have a pretty superficial knowledge about GDScript and JavaScript, however, I finished making a javascript gRPC web code that can request responses from the backend, and I made a function called GetHealth()
that returns a JSON.
What I want is to call that function and use its value, perhaps in a label or something; is that possible? If anyone can explain me or link me to anywhere making something similar I would be grateful.
My theory is that I have to do something like this:
var response = JavaScript.eval( /* function calling */ )
label.set_text(response)
However, I have no idea where my game needs to be placed or what I have to type to call that specific function. I also figured I can perhaps use localStorage, but I don’t think that’s a very straight-forward way to do it.
To be even more specific, the function I wanna call is inside a npm project that has a few libraries installed, responsible to convert/compile and read a .proto file, and my objective is to make a game web page.