I don’t know the exact answer to your question, so let’s wait for some other response, but in the other direction (from JS to Lua) I recollect this:
You can check out if it is working and useful for you ![]()
EDIT:
For the other direction Defold has a HTML5 API, so for example you can use html5.run() in your Lua code responsible for in-game button handling, to run a chunk of html with script tags inside ![]()
You can check out more in this thread - it might have a ready answer for you: