From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4B10446970F for ; Tue, 26 Nov 2019 17:55:40 +0300 (MSK) Received: by mail-lj1-f194.google.com with SMTP id j6so11561872lja.2 for ; Tue, 26 Nov 2019 06:55:40 -0800 (PST) Date: Tue, 26 Nov 2019 17:55:37 +0300 From: Cyrill Gorcunov Message-ID: <20191126145537.GB2472@uranus> References: <20191126144837.78132-1-arkholga@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191126144837.78132-1-arkholga@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v5] build: introduce LUAJIT_ENABLE_PAIRSMM flag List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Olga Arkhangelskaia Cc: tarantool-patches@dev.tarantool.org On Tue, Nov 26, 2019 at 05:48:37PM +0300, Olga Arkhangelskaia wrote: ... > + > +-- There is no Lua way to detect whether LJ_PAIRSMM is enabled. However, in > +-- tarantool build it's enabled by default. So the test scenario is following: > +-- while we can overload the pairs/ipairs behaviour via metamethod as designed > +-- in Lua 5.2, os.execute still preserves the Lua 5.1 interface. > + > +local mt = { > + __pairs = function(self) > + local function stateless_iter(tbl, k) > + local v > + k, v = next(tbl, k) > + while k and v > 0 do k, v = next(tbl, k) end > + if v then return k,v end > + end Olga, could you please fix indentation. AFAIU we tend to use 4-space tabs for lua code. Don't we? Same applies to the code below which I've just stripped out to be short.