1. Anders Ruud
  2. love
  3. Issues

Issues

Issue #97 resolved

require('love')

Anonymous created an issue

Is it possible to turn the love interpreter to some love.so shared library?

In a way that one could do require('love') inside a lua script, and get all the functionality of it.

I know the benefits of current deployment of love as standalone executable, but I was wondering if it were technically feasible to turn love applications into regular lua applications.

I was thinking.. maybe the issue would be that love has an implicit game loop? I know ruby libraries that implement this by scheduling some code to run "after" the source code is completely executed, but I don't know if lua has such facility. If not, then one indeed needs to replace the standard interpreter.

So, what if I were to convert it to a regular library (albeit with native code), and make it installable through luarocks - would it be difficult? Near impossible? Absolutely impossible? Quite easy? (Already done?)

[ .. life is short, and I actually am not considering doing it; but I offer the developer(s) the opportunity!! ]

Comments (6)

  1. Bart van Strien
    • changed status to open

    Well, theoretically it has been possible for quite some versions, but as far as I know the msvc project is the only build system that can do it. What I am considering though, is a major overhaul of the linux build system, so that might get that feature too.

    Bill, do you have any status on the lib build with the XCode project?

  2. Bill Meltsner

    Mac version is tricky to pull off. It'd require a lot of messing about with compilation options, and some ugly hacks (like preventing the Mac version of the module from being unloaded because otherwise it'll cause problems). It's doable, but not pleasantly, and not quickly.

  3. Bart van Strien

    As a status update, we do have liblove for 0.9.0, and that does mean this is at least theoretically possible, that said, I don't think slime or bmelts have gotten a working require on OSX yet. (I have played with it on linux quite a bit, and Boolsheet tested it for me on windows, too.)

  4. Alex Szpakowski

    It works on Mac OS X now, but I believe the standalone Lua interpreter (or whatever you're using to run Lua) might need to be linked to the same Lua.framework that love.framework uses. You'll also need to do something like this to get require working properly with love.framework: package.cpath = "./?.framework/?;"..package.cpath

    Creating a window with liblove via love.window.setMode won't normally work on OS X, because of how SDL 1.2's window creation code works. That caveat doesn't apply to the SDL2 branch of LÖVE over at https://bitbucket.org/bartbes/love-experiments

  5. Log in to comment