lua-users home
lua-l archive

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


Roberto Ierusalimschy wrote:

So here goes another proposal to solve the specific problem of "whole
package in one DLL" that tries to change as little as possible from
work6 require:

- add another loader after the others:
when requiring "a.b.c", it trys to find a module "a" in the C path;
if found, tries to find the function luaopen_a_b_c there and returns it.

that would be enough for my requirements.

(I assume that there is no need to pack whole *submodules* as one DLL,
so there is no need to look for a.b or anything like that.)

i would agree with this

(Unlike the original C loader, it is not a hard error not to find the
open function there. It is simply a soft error meaning "module not found
here".)


If we really want to care for the obsessive people:

- add yet another loader after the others:
when requiring "a.b.c", it trys to find a module "ALL" in the C path;
if found, tries to find a function luaopen_a_b_c there and returns it.
(I assume that there is no need to pack whole *submodules* as one DLL,
so there is no need to look for a.b or anything like that.)

this would seem overly elaborate (from my point of view).
i would be happy with just the first option.

The main benefit is that those changes to do not affect the basic
behavior of require. They only add well-behaved loaders for specific
goals. No side-effects, no hidden modules being loaded, no failed
requires. They only search for the module in extra places.

3 cheers for that.

Adrian