top | item 45504395

(no title)

strenholme | 4 months ago

There’s also a Javascript implementation of Lua which allows one to run Lua in a browser:

https://github.com/fengari-lua/fengari-web

I don’t know if this can access the DOM in Lua, but considering that Fengari is in Javascript, adding a _DOM global variable should not be too hard (if it hasn’t already been done).

discuss

order

bawolff|4 months ago

Fengari lets you access the DOM. Its pretty cool.

shakna|4 months ago

No need for _DOM.

    local js = require "js"
    local window = js.global
    local document = window.document

    window:addEventListener("load", function()
        local el = document:getElementById("main")
        el:addEventListener("click", function(evt) js.console:log(evt.target) end
        document.body:appendChild(el)
    end