lua-users home
lua-l archive

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


>>>>> "Iurii" == Iurii Belobeev <marsgpl@gmail.com> writes:

 Iurii> Hi,
 Iurii> I have this code:

In which Lua version? And is this in a dynamically loaded module, or in
a C host application?

 Iurii> I look at luaL_argerror, and I see that it calls lua_getinfo()
 Iurii> which fills lua_Debug ar.name (which is used as function name).

At least in 5.3 and 5.4 (I didn't check other versions), luaL_argerror
will try pushglobalfuncname if ar.name is NULL. pushglobalfuncname will
search for the function value in every table in the table of require'd
modules which is kept in the registry. Note that this is _NOT_ the same
as the global table (though the global table is an entry in it; the
search only goes two levels deep, so a function inside a table inside
the global table won't be found).

(If you're just creating functions in a global table then you're doing
your module creation wrong.)

-- 
Andrew.