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:
> > 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).  

<some stuff snipped>

> In Lua values are anonymous. Sometimes there are way to get a usable
> name for a value (like function names for stack tracebacks), but it not
> always possible.

I was just hoping to find somesuch function in the debug library.

> However if you have a table and you know it's a module loaded with
> require, you can get its name from package.loaded. Here is an example to
> do so:

Yeah, if t._NAME is undefined that's probably my next best bet. In all
other cases the printed module name will have to be "<unknown>" and that
is that.

Anyway, I'll try to post a working prototype for a module-supporting
Strict mode in a couple days.

And thanks for your help.