From e3eee3dc029927de6d2d8f10fa5cdd69be4c6340 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 22 Aug 2021 17:20:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83table=E6=89=A9=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/tableExtend.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zframework/tableExtend.lua b/Zframework/tableExtend.lua index abbcd2a0..4e8d5cab 100644 --- a/Zframework/tableExtend.lua +++ b/Zframework/tableExtend.lua @@ -16,10 +16,10 @@ function TABLE.shift(org,depth) if not depth then depth=1e99 end local L={} for i=1,#org do - if type(org[i])~='table'or depth==0 then - L[i]=org[i] - else + if type(org[i])=='table'and depth>0 then L[i]=TABLE.shift(org[i],depth-1) + else + L[i]=org[i] end end return L @@ -30,10 +30,10 @@ function TABLE.copy(org,depth) if not depth then depth=1e99 end local L={} for k,v in next,org do - if type(v)~='table'or depth==0 then - L[k]=v - else + if type(v)=='table'and depth>0 then L[k]=TABLE.copy(v,depth-1) + else + L[k]=v end end return L