From eb8ceef85ae8181d86e4e977ab060a477510a079 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 10 Oct 2021 10:21:59 +0800 Subject: remove some table.maxn --- xmake/core/base/interpreter.lua | 5 ++--- xmake/core/sandbox/modules/irpairs.lua | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 13225ccd5..90e0a57e5 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -459,13 +459,12 @@ function interpreter:_filter(values, level) else -- filter value or arrays values = table.wrap(values) - for idx = 1, table.maxn(values) do - + for idx = 1, #values do local value = values[idx] if type(value) == "string" then value = filter:handle(value) elseif table.is_array(value) then - for i = 1, table.maxn(value) do + for i = 1, #value do local v = value[i] if type(v) == "string" then v = filter:handle(v) diff --git a/xmake/core/sandbox/modules/irpairs.lua b/xmake/core/sandbox/modules/irpairs.lua index 7cb175173..d59574481 100644 --- a/xmake/core/sandbox/modules/irpairs.lua +++ b/xmake/core/sandbox/modules/irpairs.lua @@ -60,7 +60,7 @@ function sandbox_irpairs(t, filter, ...) -- return iterator and initialized state t = table.wrap(t) - return iter, t, table.maxn(t) + 1 + return iter, t, table.getn(t) + 1 end -- load module -- cgit v1.3.1