lua-users home
lua-l archive

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


Hi,

> I create a global value called Component1 (it can be anything but a table)
> e.g. Component1 = function() end
> 
> Then I try to require 'Tests'. I end up with
> 
>     compat-5.1.lua:122: name conflict for module `Tests.Component1'

Can you list the exactly contents of your Feature1.lua file? I'm not sure
I'm fully understanding your problem, but it  may be just a question of line
reordering. See below.

> I have not tested this with work6. Is this the intended behaviour? This
> implies that one can have a namespace A.B, but not have the B table an
element of A.
> B can be a "global".

That's the part that lost me. Since you have "Component1" both as a Lua file
(part of the Test package) and a directory (where Feature1.lua is located)
I'm not sure what module hierachy you want.

Do you want to have both the A.B.C namespace and a global (declared in
A/B.lua) called C? If that is the case then you can try defining C before
the definition of namespace A.B.C, as in (not tested)

./A/B.lua
-----------
C = function() end -- this is C, global

module "A.B.C" -- from this line forward every "global" ends in the A.B.C
namespace

function D() -- this is A.B.C.D
  C() -- calls the global defined before the module definition
end 
----------

Would that work for you? Maybe I'm completely off mark here...

Andre

<<attachment: winmail.dat>>