From 471f1076c4c6bcb1207b36d0701087f57314c6f2 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 8 Aug 2021 22:30:23 +0800 Subject: [PATCH] =?UTF-8?q?TABLE.shift=E6=96=B0=E5=A2=9Edepth=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/tableExtend.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Zframework/tableExtend.lua b/Zframework/tableExtend.lua index 1c326d52..abbcd2a0 100644 --- a/Zframework/tableExtend.lua +++ b/Zframework/tableExtend.lua @@ -12,13 +12,14 @@ function TABLE.new(val,count) end --Get a copy of [1~#] elements -function TABLE.shift(org) +function TABLE.shift(org,depth) + if not depth then depth=1e99 end local L={} for i=1,#org do - if type(org[i])~='table'then + if type(org[i])~='table'or depth==0 then L[i]=org[i] else - L[i]=TABLE.shift(org[i]) + L[i]=TABLE.shift(org[i],depth-1) end end return L