整理table扩展模块代码
This commit is contained in:
@@ -28,11 +28,11 @@ function TABLE.copy(org)
|
||||
end
|
||||
|
||||
--For all things in G if same type in base, push to base
|
||||
function TABLE.add(G,base)
|
||||
function TABLE.update(G,base)
|
||||
for k,v in next,G do
|
||||
if type(v)==type(base[k])then
|
||||
if type(v)=="table"then
|
||||
TABLE.add(v,base[k])
|
||||
TABLE.update(v,base[k])
|
||||
else
|
||||
base[k]=v
|
||||
end
|
||||
@@ -40,13 +40,6 @@ function TABLE.add(G,base)
|
||||
end
|
||||
end
|
||||
|
||||
--Clear the table
|
||||
function TABLE.clear(G)
|
||||
for k in next,G do
|
||||
G[k]=nil
|
||||
end
|
||||
end
|
||||
|
||||
--For all things in G if no val in base, push to base
|
||||
function TABLE.complete(G,base)
|
||||
for k,v in next,G do
|
||||
@@ -58,6 +51,20 @@ function TABLE.complete(G,base)
|
||||
end
|
||||
end
|
||||
|
||||
--Remove positive integer index of table
|
||||
function TABLE.cut(G)
|
||||
for i=#G,1,-1 do
|
||||
G[i]=nil
|
||||
end
|
||||
end
|
||||
|
||||
--Clear table
|
||||
function TABLE.clear(G)
|
||||
for k in next,G do
|
||||
G[k]=nil
|
||||
end
|
||||
end
|
||||
|
||||
--Re-index string value of a table
|
||||
function TABLE.reIndex(org)
|
||||
for k,v in next,org do
|
||||
|
||||
Reference in New Issue
Block a user