整理代码习惯,常量字符串改用单引号,可能有遗漏
This commit is contained in:
@@ -5,7 +5,7 @@ local TABLE={}
|
||||
function TABLE.shift(org)
|
||||
local L={}
|
||||
for i=1,#org do
|
||||
if type(org[i])~="table"then
|
||||
if type(org[i])~='table'then
|
||||
L[i]=org[i]
|
||||
else
|
||||
L[i]=TABLE.shift(org[i])
|
||||
@@ -18,7 +18,7 @@ end
|
||||
function TABLE.copy(org)
|
||||
local L={}
|
||||
for k,v in next,org do
|
||||
if type(v)~="table"then
|
||||
if type(v)~='table'then
|
||||
L[k]=v
|
||||
else
|
||||
L[k]=TABLE.copy(v)
|
||||
@@ -31,7 +31,7 @@ end
|
||||
function TABLE.update(new,old)
|
||||
for k,v in next,new do
|
||||
if type(v)==type(old[k])then
|
||||
if type(v)=="table"then
|
||||
if type(v)=='table'then
|
||||
TABLE.update(v,old[k])
|
||||
else
|
||||
old[k]=v
|
||||
@@ -45,7 +45,7 @@ function TABLE.complete(new,old)
|
||||
for k,v in next,new do
|
||||
if old[k]==nil then
|
||||
old[k]=v
|
||||
elseif type(v)=="table"and type(old[k])=="table"then
|
||||
elseif type(v)=='table'and type(old[k])=='table'then
|
||||
TABLE.complete(v,old[k])
|
||||
end
|
||||
end
|
||||
@@ -68,7 +68,7 @@ end
|
||||
--Re-index string value of a table
|
||||
function TABLE.reIndex(org)
|
||||
for k,v in next,org do
|
||||
if type(v)=="string"then
|
||||
if type(v)=='string'then
|
||||
org[k]=org[v]
|
||||
end
|
||||
end
|
||||
@@ -92,34 +92,34 @@ do--function TABLE.dump(L,t)
|
||||
else
|
||||
s="return{\n"
|
||||
t=1
|
||||
if type(L)~="table"then
|
||||
if type(L)~='table'then
|
||||
return
|
||||
end
|
||||
end
|
||||
local count=1
|
||||
for k,v in next,L do
|
||||
local T=type(k)
|
||||
if T=="number"then
|
||||
if T=='number'then
|
||||
if k==count then
|
||||
k=""
|
||||
count=count+1
|
||||
else
|
||||
k="["..k.."]="
|
||||
end
|
||||
elseif T=="string"then
|
||||
elseif T=='string'then
|
||||
if find(k,"[^0-9a-zA-Z_]")then
|
||||
k="[\""..k.."\"]="
|
||||
else
|
||||
k=k.."="
|
||||
end
|
||||
elseif T=="boolean"then k="["..k.."]="
|
||||
elseif T=='boolean'then k="["..k.."]="
|
||||
else error("Error key type!")
|
||||
end
|
||||
T=type(v)
|
||||
if T=="number"then v=tostring(v)
|
||||
elseif T=="string"then v="\""..v.."\""
|
||||
elseif T=="table"then v=dump(v,t+1)
|
||||
elseif T=="boolean"then v=tostring(v)
|
||||
if T=='number'then v=tostring(v)
|
||||
elseif T=='string'then v="\""..v.."\""
|
||||
elseif T=='table'then v=dump(v,t+1)
|
||||
elseif T=='boolean'then v=tostring(v)
|
||||
else error("Error data type!")
|
||||
end
|
||||
s=s..tabs[t]..k..v..",\n"
|
||||
|
||||
Reference in New Issue
Block a user