Davidobot / love.js

LÖVE ported to the web using Emscripten, updated to the latest Emscripten and LÖVE (v11.5)
MIT License
624 stars 28 forks source link

Interaction between Javascript and Lua #36

Closed Sheepolution closed 3 years ago

Sheepolution commented 3 years ago

I would like to be able to set a variable in LÖVE that I can then read with Javascript.

So very simple:

-- Lua
foo = true
// Javascript
bar = loveWasm.getValue("foo")
if (bar) {
  console.log("foo is true");
}

This could allow for page and game interactions which can be useful.

Davidobot commented 3 years ago

You're probably looking for https://github.com/Davidobot/love.js/issues/26 ?

Sheepolution commented 3 years ago

Oh, I suppose I do. Thanks, and sorry for missing that issue.