[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Problems with compat-5.1 release 3
- From: Renato Maia <maia@...>
- Date: Mon, 20 Jun 2005 13:53:35 -0300 (BRT)
> > For example, one cannot create the module 'mymodule.assert' or
> > 'mymodule.error' if the basic library is loaded in the Lua state.
> It seems to be working fine here. Can you send a small set of scripts
> that fails? I wrote a file called error.lua, and placed in a directory
OK, most probably I didn't make myself clear enough. Maybe I should better
have said that one cannot create the module 'mymodule.assert' or
'mymodule.error' once the module 'mymodule' were previously created using
the module function. This happens because all global variables are
accessible through the table of a module (in this case, the table
'mymodule'). This way 'compat-5.1.lua' thinks there is some conflict at
'mymodule.error'. A small script that shows the problem is:
Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
> module "mymodule"
> module "mymodule.error"
compat-5.1.lua:200: name conflict for module `mymodule.error'
[C]: in function `error'
compat-5.1.lua:200: in function `module'
stdin:1: in main chunk
> In Lua 5.1, we have the _M field in the namespace, pointing to itself.
> It works like the _G field, but only for modules. The new version of
> compat will do the same.
Thanks! That will do the trick ;-)