几个table相关函数独立成TABLE模块

This commit is contained in:
MrZ626
2021-03-05 09:31:19 +08:00
parent b1ca2c8dda
commit 75f1651042
7 changed files with 26 additions and 21 deletions

View File

@@ -86,7 +86,7 @@ end
function newBoard(f)--Generate a new board
if f then
return copyList(f)
return TABLE.shift(f)
else
local F={}
for i=1,20 do F[i]={0,0,0,0,0,0,0,0,0,0}end
@@ -710,7 +710,7 @@ do--function resetGameData(args)
local S={}
for _,key in next,gameSetting do
if type(SETTING[key])=="table"then
S[key]=copyList(SETTING[key])
S[key]=TABLE.shift(SETTING[key])
else
S[key]=SETTING[key]
end

View File

@@ -309,7 +309,9 @@ SETTING={--Settings
VKCurW=.4,--Cur-Pos Weight
VKIcon=true,--If disp icon
VKAlpha=.3,
}local S=FILE.load("conf/settings")if S then addToTable(S,SETTING)end
}
local S=FILE.load("conf/settings")
if S then TABLE.add(S,SETTING)end
S=FILE.load("conf/data")
if S then--Statistics
STAT=S

View File

@@ -211,7 +211,7 @@ local function loadGameEnv(P)--Load gameEnv
if type(v)~="table"then--Default setting
ENV[k]=v
else
ENV[k]=copyTable(v)
ENV[k]=TABLE.copy(v)
end
end
if not ENV.noMod then
@@ -244,7 +244,7 @@ local function loadRemoteEnv(P,confStr)--Load gameEnv
if type(v)~="table"then--Default setting
ENV[k]=v
else
ENV[k]=copyTable(v)
ENV[k]=TABLE.copy(v)
end
end
end

View File

@@ -49,7 +49,7 @@ scene.widgetList={
WIDGET.newButton{name="importUnlock", x=190,y=300,w=280,h=100,color="lBlue",font=25,code=function()
local D=parseCB()
if D then
addToTable(D,RANKS)
TABLE.add(D,RANKS)
FILE.save(RANKS,"conf/unlock")
else
LOG.print(text.importSuccess,COLOR.green)
@@ -58,7 +58,7 @@ scene.widgetList={
WIDGET.newButton{name="importData", x=490,y=300,w=280,h=100,color="lBlue",font=25,code=function()
local D=parseCB()
if D then
addToTable(D,STAT)
TABLE.add(D,STAT)
FILE.save(STAT,"conf/data")
else
LOG.print(text.importSuccess,COLOR.green)
@@ -67,7 +67,7 @@ scene.widgetList={
WIDGET.newButton{name="importSetting", x=790,y=300,w=280,h=100,color="lBlue",font=25,code=function()
local D=parseCB()
if D then
addToTable(D,SETTING)
TABLE.add(D,SETTING)
FILE.save(SETTING,"conf/settings")
else
LOG.print(text.importSuccess,COLOR.green)
@@ -76,7 +76,7 @@ scene.widgetList={
WIDGET.newButton{name="importVK", x=1090,y=300,w=280,h=100,color="lBlue",font=25,code=function()
local D=parseCB()
if D then
addToTable(D,VK_org)
TABLE.add(D,VK_org)
FILE.save(VK_org,"conf/virtualkey")
else
LOG.print(text.importSuccess,COLOR.green)