[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: "require" succesful, but returns "nil"
- From: Patrick Donnelly <batrick@...>
- Date: Thu, 19 Jul 2007 15:59:34 -0600
> You know what the problem was? I was inputting the lines at the Lua
> command prompt and thus "local tmp = ... " was different variable than
> the one in "print (tmp)". Oops... Sorry all...
"Yes, I understand perfectly. However, according to the documentation
for "require" (http://www.lua.org/manual/5.1/manual.html#pdf-require),
after calling require ("foo") while the "foo" file begins with
"module(bar)", the value of package.loaded["foo"] ("foo", not "bar"!)
should be set to true, which it isn't. It's nil!"
Did you actually test package.loaded.foo is nil or not? I'm betting you did not.
"One of the lessons of history is that nothing is often a good thing to do and always a clever thing to say."