[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require versus straight call..
- From: "Patrick Donnelly" <batrick.donnelly@...>
- Date: Mon, 17 Mar 2008 01:00:58 -0700
require() lets the module put it's return value in package.loaded, so
you should do the same. I believe it would be the same as:
package.loaded["name"] = dofile("modulefile")("name") == nil or true;
Technically it's not EXACTLY the same because require() allows nil to
be a result from the module, so you could simulate this behavior
(similar to how Lua does it) by using a function call to check the
number of results from dofile().
HTH,
--
-Patrick Donnelly
"One of the lessons of history is that nothing is often a good thing
to do and always a clever thing to say."
-Will Durant