lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Jan 19, 2011 at 12:53:13PM +0200, Dirk Laurie wrote:
> On Wed, Jan 19, 2011 at 08:48:22AM +0200, Alexander Gladysh wrote:
> > 
> > You have Lua 5.0 installed, and no Lua 5.1. Remove Lua 5.0 and install
> > 5.1 instead. (Ubuntu packaging for Lua and modules is somewhat weird
> > sometimes.)
> > 
> Many modules, e.g lpeg, go into /usr/lib but the lua executable
> looks in /usr/local/lib, for example.

All Lua 5.1 modules packaged for Debian/Ubuntu are installed in /usr/lib
and are named liblua5.1-something.so.x.y.z and are symlinked in
/usr/lib/lua/5.1/something.so. In this way you can require "something"
as expected.

The lua5.1 interpreter shipped with Debian/Ubuntu looks for modules 
that are required _also_ in /usr/local/lib/lua/5.1/ to allow users to
install custom modules without having to recompile the interpreter by
hand, and possibly to override standard ones (/usr/loca/lib/lua5.1 is
preferred to /usr/lib/lua/5.1). 

This is pretty standard in *nix systems, for example your shell looks
for the commands you type according to the PATH variable, that looks like:

  /home/tassi/bin:/usr/local/bin:/usr/bin:/bin

With the following command you will see the list of paths the
interpreter scans when require is executed:

  lua -e 'print(package.cpath)'

On my system, that's the output:

  ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/lib/lua/5.1/?.so;...

Cheers
-- 
Enrico Tassi