Javascript HTML5 Extension

There are currently no way to call Lua from JS. Don’t know if there is a way to write a native extension for this, you would have to explore the emscripten documentation.

I recently used html5.run to poll for a variable on the JS side, if the var was set then I just called another JS function to return some new data. Same procedure as @Mathias_Westerdahl mentioned above, works really good.

1 Like

I think that you need something like this https://github.com/subsoap/defos/blob/7c8bbd58f2f21292a2f1baa7e9c62233c2d808bf/defos/src/defos_html5.cpp#L38

2 Likes

You can setup a polling based callback with html.run() on update periodically, and then use

local f = assert(loadstring(sys.load_resource(code)))

to load the arbitrary Lua which can then be ran or

assert(loadstring(sys.load_resource(code)))()

to run it directly I think?