3 ms·
Well as for simply supporting Lua in browsers, aside from the obvious Emscripten/ASM.js way, which would work for practically all browsers which support JavaScr
by ackalker 12y ago
Well as for simply supporting Lua in browsers, aside from the obvious Emscripten/ASM.js way, which would work for practically all browsers which support JavaScript, Lua can run as a PNaCl app in Chrome/Chromium, see: https://chrome.google.com/webstore/detail/lua/nkcnhkobblkmiampcmimoemaeffjopph?hl=en https://chrome.google.com/webstore/detail/lua/nkcnhkobblkmia...
Of course this is only a proof-of-concept which just runs a Lua REPL in the browser. I wonder if it is possible (and if so, how hard it is) to make the browser run <script language="lua"></script> code.
- justincormack 12y agoYou need to define a DOM interface to do anything useful, which is a fair amount of work.
- daurnimator 12y agolua.vm.js can manipulate javascript objects. the only outstanding issue is tracking garbage (lua closures can leak into javascript). In regards to actually doing the DOM work, craig barnes is doing great work over with lua-gumbo: https://github.com/craigbarnes/lua-gumbo https://github.com/craigbarnes/lua-gumbo
- daurnimator 12y agoIt supports script tags: https://kripken.github.io/lua.vm.js/repl.html https://kripken.github.io/lua.vm.js/repl.html Code that does it: https://github.com/kripken/lua.vm.js/blob/master/src/lua.js#L647 https://github.com/kripken/lua.vm.js/blob/master/src/lua.js#...