[Tarantool-patches] [PATCH v5] build: introduce LUAJIT_ENABLE_PAIRSMM flag
Cyrill Gorcunov
gorcunov at gmail.com
Tue Nov 26 17:55:37 MSK 2019
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.
More information about the Tarantool-patches
mailing list