From f3eb95df9365a5dcd80652ee0e0ccc9ee7d9c183 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 10 May 2021 15:53:14 +0800 Subject: [PATCH] =?UTF-8?q?table=E6=89=A9=E5=B1=95=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=A4=E4=B8=AA=E6=90=9C=E7=B4=A2=E7=94=A8?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/tableExtend.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Zframework/tableExtend.lua b/Zframework/tableExtend.lua index 0c876ab0..8511354e 100644 --- a/Zframework/tableExtend.lua +++ b/Zframework/tableExtend.lua @@ -75,6 +75,16 @@ function TABLE.clear(G) end end +--Find value in [1~#] +function TABLE.find(t,val) + for i=1,#t do if t[i]==val then return i end end +end + +--Find value in whole table +function TABLE.search(t,val) + for k,v in next,t do if v==val then return k end end +end + --Re-index string value of a table function TABLE.reIndex(org) for k,v in next,org do