lua-users home
lua-l archive

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


On Fri, May 31, 2013 at 1:19 AM, Paul K <paulclinger@yahoo.com> wrote:
> Hi Chris,
>
>> If I change the library name to literally anything else, it works fine. I'm fairly new to lua, so I may be missing something. But I can't think of any reason why this should be happening. Have I found some obscure bug, or am I on crack?
>
> You named your file taboo.lua and are trying to load a module with the
> same name. "require" loads the same file, it gets executed, hits
> "require", it loads the same file and so on until you hit recursion
> limit.
>

Isn't  require supposed to set  package.loaded[modname]  to some true
value *before* it executes the module chunk to prevent a possibility
of an infinite recursion? If it is not the case and require can cause
an infinite recursion then it is a bug in Lua module system.
Requiring modules can produce cycles  (directly or indirectly) and a
package loader should be prepared to handle this possibility.

--Leo--