[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (work4) now available
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 2 Aug 2010 13:38:56 -0300
> > isn't require() the one that writes the module in package.loaded?
> > [...]
>
> It's a bit more complicated than one or the other - require() will not
> overwrite a value set into package.loaded[...] if the loader function
> sets it directly, and module(...) does just that.
Not exactly. require will not overwrite whatever is in
package.loaded[...] only if the module returns nothing (or nil).
If the module returns a value, that value will overwrite whatever
is in package.loaded.
This is the kind of complexity that we think most users do not need
to know.
-- Roberto