Davidobot / love.js

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

Detect whether we're running using love.js in Lua #74

Closed Svalorzen closed 1 year ago

Svalorzen commented 1 year ago

I'm using Love2D for a project. My goal is to release it as a standalone executable, but until then I've setup love.js so that I can quickly share my progress. However, some things in the project don't fully work right with love.js (bit require for example), and some behaviors aren't probably the best when using my project in the browser.

I was wondering whether there might be a way, from the love lua code, to detect whether the project is running under love.js. Then I could skip certain imports or slightly tweak things for the browser export, while keeping everything the same for a normal deployment.

Davidobot commented 1 year ago

Sure, https://love2d.org/wiki/love.system.getOS will return "web"