[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: RES: package system modification (module loaders)
- From: duck <duck@...>
- Date: Mon, 17 Jan 2005 11:04:24 +0000
> > Also, Lua 5.1 work 4 contains an oficial implementation of
> > the "packaging proposal" :-)
>
> I have that, but not being familiar with Lua I can't pick
> the difference from the old system just by examining the code.
Roberto's email from mid-ish September 2004 sort of lays it out.
I'm no expert, but AFAICS the main advances in the new packaging
system are:
1. package.loaded to replace _LOADED, whereby require() (or you) can see
if something is already loaded and initialised;
2. package.preload, whereby you can easily statically link an extension
module and save its init function so that a later require() can call it
at run time;
3. require() seamlessly handles dynamically-linked extension libs,
statically-linked but not-yet-initted extension libs, and Lua code in
source or compiled form;
4. hierarchical naming, so that you can name modules "fruit.mango" and
"fruit.banana" and have them loaded into the package tree separately.
I hope I have the terms packages and modules straight :-)
>From my point of view (single-EXE non-unpacking scripts on Windows)
the package.preload table is the most useful part. Simple and effective.