Reputation: 5648
I'm trying to use the luafun
library with love2d
.
Running lua main.lua
, however love .
complains about the missing fun
library.
I have installed luafun
with luarocks
.
Upvotes: 3
Views: 1895
Reputation: 4264
There's two options.
If you want to distribute whatever you're building, you almost certainly don't want users to install Lua, luarocks, etc. etc. - so the best way is to simply put any libraries into the folder that your game/program/… lives in. (If a library contains compiled things, you'll need to build per platform/OS and then you'll actually want a build process that spits out the various variants, but if it's all-Lua, there's no platform-specific stuff, so just copy it in.)
The other option (mostly for when you only need it to work on your machine) is to adjust package.path
and then love
will find things just fine. If you use LUA_INIT
/ LUA_PATH
on your machine, Love ignores them but you can manually fetch & process them using os.getenv
, dofile
/ load(code)()
& friends. (As the very simplest special case of this, if luarocks is installed in the standard Lua search path, saying require "luarocks.loader"
might be enough to get all luarocks-installed packages to work.)
Upvotes: 7