lua-users home
lua-l archive

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


Since 5.1 modules can expect to be loaded by the require function. And that function do some things that modules relying on 5.1 package model could expect: passing the module name as first parameter and putting the module return value or true in package.loaded[modulename].

I think designing standard libraries just like modules was a good thing. The only thing I don't like about the new package system is that standard libraries, luaL_register and the 'module' function set globals.

> -----Message d'origine-----
> De : lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] De la part de Rici Lake
> Envoyé : 3 novembre 2006 00:21
> À : Lua list
> Objet : Re: Current state of 5.1, and the PS2.
> 
> 
> On 2-Nov-06, at 11:27 PM, Glenn Maynard wrote:
> 
> > But the balance might be different if I was loading more libraries.
> 
> Yeah, I usually have quite a few more than that in any given 
> project. I build something a lot like the linit.c file with a 
> script that looks for definitions of luaopen_* functions, so 
> that I can just use one line to add the project. The script 
> is run by make, and it's all a bit kludgy, but it works out 
> well for me.
> 
> Adding the package name is probably unnecessary, but I put it 
> in anyway in case some module I'm using which someone else 
> wrote needs it. I've yet to write a module which does, but a 
> lot of mine do use the callframe's function environment.
> 
>