[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Separate groups of scripts
- From: Michal Kolodziejczyk <miko@...>
- Date: Wed, 23 Sep 2009 15:23:58 +0200
Shmuel Zeigerman wrote:
> Michal Kolodziejczyk wrote:
>> /etc/luaenv.lua:
>> package.path=os.getenv('HOME')..'/lua;'..package.path
Steve: thanks for the correction! (it should be "?.lua")
> There seems to be misunderstanding (probably because I was using the
> word 'user' in a confusing way). What happens in fact is:
So you should use word "subdirectory" or "module author" I think.
[...]
> -- there can be quite a few "programmers"
>
> -- user Jim installs: the main program + John's scripts + Ann's scripts
>
> -- user Jim can at any moment invoke *any* script, via the program menu
> or a hot key
So don't bother with package.path (don't allow users change that!), use
full module names:
module1=require "plugin.Ann.module1"
module2=require "plugin.John.module2"
> -- in the invoked script, require 'somelib' could access a wrong module,
> if both John and Ann happened to have a module named 'somelib'.
This is another problem, solved in Java by using full module names
beginning with reversed domain name of the module author, so:
org.lua.module1, com.john.module2 etc.
Regards,
miko