table扩展模块新增一个函数
This commit is contained in:
@@ -102,6 +102,11 @@ function TABLE.find(t,val)
|
|||||||
for i=1,#t do if t[i]==val then return i end end
|
for i=1,#t do if t[i]==val then return i end end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Retuen next value of [1~#]
|
||||||
|
function TABLE.next(t,val)
|
||||||
|
for i=1,#t do if t[i]==val then return t[i%#t+1]end end
|
||||||
|
end
|
||||||
|
|
||||||
--Find value in whole table
|
--Find value in whole table
|
||||||
function TABLE.search(t,val)
|
function TABLE.search(t,val)
|
||||||
for k,v in next,t do if v==val then return k end end
|
for k,v in next,t do if v==val then return k end end
|
||||||
|
|||||||
Reference in New Issue
Block a user