[Tarantool-patches] [PATCH v20 6/7] box: implement box.lib module

Cyrill Gorcunov gorcunov at gmail.com
Wed Apr 7 23:22:21 MSK 2021


On Wed, Apr 07, 2021 at 07:59:35PM +0300, Cyrill Gorcunov wrote:
> > > +/** Handle __index request for a module object. */
> > > +static int
> > > +lbox_module_index(struct lua_State *L)
> > > +{
> > > +	lua_getmetatable(L, 1);
> > > +	lua_pushvalue(L, 2);
> > > +	lua_rawget(L, -2);
> > > +	if (!lua_isnil(L, -1))
> > > +		return 1;
> > 
> > 6. What is happening here in these 5 lines?
> 
> Actually this snippet comes from popen code where
> we have wrappers on lua level and test for metamethods.
> While it doesn't hurt it makes no much sense in current
> code, thanks! Will drop.

Heh, in real we need these to handle metamethods such as
"module:load". I added a comment into the code.


More information about the Tarantool-patches mailing list