lua-users home
lua-l archive

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


"Jerome Vuarand" <jerome.vuarand@ubisoft.com>  wrote:

> Thomas Lauer wrote:
> > However, if the error occurs in connection with a module (if, for
> > example, someone refers to a non-existent function or variable in a
> > module), the message doesn't show the name of the module. For all
> > user-defined modules this is in module._NAME, so I can easily
> > retrieve and print it.    
> 
> Not all user-defined modules have _NAME, _M and _PACKAGE. Only the
> modules calling the 'module' function of the base Lua API do. If you
> have control on all your modules you can assume that, but for
> third-party modules this is not a requirement.

You're of course right. I suppose my enthusiasm for the 5.1 module
system got me carried away.

It seems what I need is a general way to get the printable name of a
table (assuming that a module resides, one way or another, in a table).

A quick look at the debug library has not shown me an easy way to do
that so I'll have to try something homegrown. Or has someone an idea as
to how to do this?

(I know that whatever I'll end up doing it won't work with compiled
code; that's fine as this strict layer is more a debug measure than
anything else.)
-- 
cheers  thomasl

web : http://thomaslauer.com/start