[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Installing Lua and add-ons
- From: Jose Torre-Bueno <jtorrebueno@...>
- Date: Thu, 12 Apr 2012 08:02:04 -0700
Thanks, I know that package.path is writeable so basically any organization of directories is possible, I do have a question about convention or custom. That is is there an organization of directories for packages that a vanilla Lua instal expects or that most packages expect? In setting up a system it seems to me it will be quicker to follow convention than create my own style.
On Apr 10, 2012, at 1:50 AM, steve donovan wrote:
> On Mon, Apr 9, 2012 at 6:17 PM, Jose Torre-Bueno <jtorrebueno@cox.net> wrote:
>> know that basically any directory structure can be set up but Lua and its
>> add-ons seem to have some standard structure as the default and
>> understanding that would help also.
>
> The cool thing is the error messages tell you exactly where Lua is
> expecting to find modules; this is a Debian system, but the same
> principles apply. When Lua requires a module, it will look in the
> path contained in package.path, which is always semi-colon separated;
> the ? is replaced by the module name. The error trace when you fail
> to load a module tells you exactly where Lua has looked for the Lua
> file, and if it fails, it starts looking for C extensions (which are
> also .so on Mac OS).
>
> /mnt/extra/lua/luabuild$ lua
> Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
>> require 'pedro'
> stdin:1: module 'pedro' not found:
> no field package.preload['pedro']
> no file './pedro.lua'
> no file '/usr/local/share/lua/5.1/pedro.lua'
> no file '/usr/local/share/lua/5.1/pedro/init.lua'
> no file '/usr/local/lib/lua/5.1/pedro.lua'
> no file '/usr/local/lib/lua/5.1/pedro/init.lua'
> no file './pedro.so'
> no file '/usr/local/lib/lua/5.1/pedro.so'
> no file '/usr/local/lib/lua/5.1/loadall.so'
>> = package.path
> ;./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/home/sdonovan/projects/lua/lua/?.lua;/home/sdonovan/projects/lua/lua/?/init.lua
>> = package.cpath
> ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so
>>
>
> If you had pedro.lua somewhere, you now know that you must copy it to
> /usr/local/share/lua/5.1 for require() to find it.
>
> steve d.
>