[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A major problem with the Lua ecosystem
- From: Dibyendu Majumdar <mobile@...>
- Date: Tue, 6 Feb 2018 20:54:26 +0000
Hi Sean,
On 1 February 2018 at 23:22, Sean Conner <sean@conman.org> wrote:
> my syslog module [1] is a
> C-based module. When you do:
>
> local syslog = require "org.conman.syslog"
>
> Lua will replace the dots with the file separator (in my case '/'):
>
> org/conman/syslog
>
> and for each component in package.cpath (broken out for easier reading):
>
> /home/spc/.luarocks/lib/lua/5.1/?.so
> ./?.so
> /usr/local/lib/lua/5.1/?.so
> /usr/local/lib/lua/5.1/loadall.so
>
> will replace the '?' with the modified module name:
>
> /home/spc/.luarocks/lib/lua/5.1/org/conman/syslog.so
> ./org/conman/syslog.so
> /usr/local/lib/lua/5.1/org/conman/syslog.so
> /usr/local/lib/lua/5.1/loadall.so
>
> and will attempt to load each .so file in turn. Further more, to illustrate
> a potentinal problem, I installed org.conman.syslog twice, once manually and
> once via LuaRocks.
>
> [spc]lucy:~>luawhich org.conman.syslog # [2]
> /home/spc/.luarocks/lib/lua/5.1/org/conman/syslog.so
> /usr/local/lib/lua/5.1/org/conman/syslog.so
>
> In this case, Lua will load "/home/spc/.luarocks/lib/lua/5.1/org/conman/syslog.so" since it is found
> first by Lua.
>
Thank you for this example. I will use this model - I suppose if the
libraries did not depend on each other other than via Lua, then it
should work fine.
I think the mechanism is described in the Lua manual in a brief way so
I never really "saw" it.
Regards
Dibyendu