Overview

Lust

Lust is an extension for LÖVE that allows you to download libraries directly from:

  • bitbucket
  • github
  • the love forums
  • http
  • https

Usage

url     = lust.getUrl(libid)               --> turns a libid into a fully-qualified url
success = lust.getFile(url, filename)      --> downloads a file from url to filename
          lust.remove(requirespec_libid)   --> removes the file corresponding to the requirespec or libid
...     = lust.require(libid)              --> downloads and requires a lua file
...     = lust(libid)                      --> alias for lust.require

libid

A libid is created as follows: <source>:<source-id>:<requirespec>

Where <source> is one of the following:

  • bitbucket, <source-id> is the repo name
  • github, <source-id> is the repo name
  • loveclub, <source-id> is the attachment id
  • http, looks like a normal http url, but with a requirespec at the end
  • https, like http

Compiling

This currently compiles on select linux computers. Don't worry, though, the code should be completely portable.

Hint: make install compiles and installs the module in your love save dir (where it loads binary modules from. The inverse operation is, of course, make uninstall.

Useful Makefile variables

As you may or may not know, you can override variables of the makefile using the following syntax: make VARIABLE=value

The makefile has the following variables you might want to override:

  • CURLINCLUDE: The location of the curl headers. (default: -I/usr/include/curl)
  • LIBEXTENSION: The extension of the created library, without period. (default: so)
  • SAVEDIR: The location of the save directory, for the install target. (default: ~/.local/share/love/)

Compiling without the (current) Makefile

You can, of course, compile without the Makefile:

  • Generate lust.lua.h with lua auto.lua lust.
  • Compile lust.cpp and wrap_lust.cpp, setting the include directory for curl and lua.
  • Link the object files against curl, into a dynamic library.
  • Place the dynamic library in the generic save directory of love:
    • Windows: %APPDATA%\LOVE
    • OSX: /Users/user/Library/Application Support/LOVE/
    • Linux: $XDG_DATA_HOME/love ($XDG_DATA_HOME defaults to ~/.local/share)

The Makefile and mingw

A successful mingw compile was done using: make CXX=i486-mingw32-g++ CURLINCLUDE="-I/usr/i486-mingw32/include/curl" LIBEXTENSION="dll" LIBS="-lcurl -llua -lphysfs -Wl,--export-all-symbols"

However, it seems to crash while running, it is, at this point unclear what the cause is. (It might be running a mingw dll with an msvc love.)

Test

There's a test file included, enter the directory and run it with love . <libnames>.

<libnames> can be any (and multiple) of:

  • inifile
  • slither
  • debug