lua-users home
lua-l archive

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

Dear Luiz,

> > First of all the main program require(FileA) and FileA then
> > require(FileB) and if FileB now require(FileA) again then ups we
> > are falling into a loop. But why? Because FileA is already required
> > with the first call from the main prog.

> This seems correct to me: "require" is for loading libraries and
> your hierarchy of libraries has a loop.

Correct I have a loop and would like to arrange with it instead of a
dull redesign. Each of two simple libs thematically separated need the
opposite one. Isn't require() designed to load/require one file only
once? dofile doesn't help here because if five libs need the XML lib
then the XML lib is dofiled five times! I know I can arrange an own
solution to suppress both behaviours (patch require or check if a
file is already slowly dofiled) but I feel that require() should do this
alone. Now require isn't so much usefull as it could be. And I don't see
arguments to let require() as it is.