From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 1B1086EC5D; Wed, 7 Apr 2021 23:22:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1B1086EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617826946; bh=ieTIH9sMxnsjt91ZEjKNzUKvYFWnq1mYbBxS/hxHsDc=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=R+MICGaaei27/ufDFHJn7gz0KNHcX/dco625FqWhcQZB0I4ugqO5uyFuCzzxIRATi T/7jhX7FE9AHmueA3HhYqJWX1s9ShtMV4W9xu6WdPQinAAVG7r/mspYSiEWl1KQ1cg 3s6PuHXNBWOq1dMkw34cz4SKAASkPpsiUPpwxHVk= Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id ADA286EC5D for ; Wed, 7 Apr 2021 23:22:24 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ADA286EC5D Received: by mail-lj1-f178.google.com with SMTP id u20so22204715lja.13 for ; Wed, 07 Apr 2021 13:22:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jXez3W/8axrco3FjiFq5M6QGwsByNdu+JzK0hrdKR58=; b=tE1qt8SVTFeswGBvt6px9VNXjZGqbsoNn+COw/mAy/ZQf5dyv1B7KL4KZmNjSk2sD9 orxKuR+F1NG71mmm/EtBhZnJYrH0GU0OEp2g+HS+hgJjtUIMNO9tnDYtRZLa6rvBGxe/ 99tth9VYbcda47hCFQehJiQdb0qsqBtAESC8+ORdBjdJfso5CJD2TITUX9/T5de7cdGp TJAan9oAaOs0Nm+/cljMu2TXzUNX52KcLoW/6PA/jLlNc0V/J08eZeCkp9lMKh6HQENQ qs9A/BvQucsmSFM2yR8q763oI/dY0DGxdtqZU6IfjD6hBhvngDfG4qrLGJpTBhYHAeuQ Pc7Q== X-Gm-Message-State: AOAM533cq7HRIQ1y4EcT2W2Y0y5L8KLHhpx5O7k3TgPGJu/755lykxHS ONuBnq0re/dh2lRNW0bN+dGVwsC8PU0= X-Google-Smtp-Source: ABdhPJxYkKH6CA4bYQkMIbuVNjeMwKRE5vHTCmjYlO2IXjbedbXp+mFlyefYP0CyH6jGHNcs8MHniA== X-Received: by 2002:a2e:5c47:: with SMTP id q68mr3308774ljb.314.1617826943496; Wed, 07 Apr 2021 13:22:23 -0700 (PDT) Received: from grain.localdomain ([5.18.199.94]) by smtp.gmail.com with ESMTPSA id o22sm2638321ljh.31.2021.04.07.13.22.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 13:22:22 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id E73BD5601D6; Wed, 7 Apr 2021 23:22:21 +0300 (MSK) Date: Wed, 7 Apr 2021 23:22:21 +0300 To: Vladislav Shpilevoy Message-ID: References: <20210402123420.885834-1-gorcunov@gmail.com> <20210402123420.885834-7-gorcunov@gmail.com> <8d3a4d20-2887-7423-777f-2af808b65495@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) Subject: Re: [Tarantool-patches] [PATCH v20 6/7] box: implement box.lib module X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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.