整理代码

This commit is contained in:
MrZ626
2021-12-18 16:08:45 +08:00
parent d6ab7e72b2
commit 226e45b24d
7 changed files with 8 additions and 7 deletions

View File

@@ -86,6 +86,7 @@ mDraw=GC.draw
Snd=SFX.playSample Snd=SFX.playSample
string.repD=STRING.repD string.repD=STRING.repD
string.sArg=STRING.sArg string.sArg=STRING.sArg
string.split=STRING.split
--Delete all naked files (from too old version) --Delete all naked files (from too old version)
FILE.clear('') FILE.clear('')

View File

@@ -79,7 +79,7 @@ end
--Parse notice --Parse notice
local function _parseNotice(str) local function _parseNotice(str)
if str:find("///")then if str:find("///")then
str=STRING.split(str,"///") str=str:split("///")
for i=1,#str do for i=1,#str do
local m=str[i] local m=str[i]
if m:find("=")then if m:find("=")then

View File

@@ -232,7 +232,7 @@ local commands={}do
commands.mv={ commands.mv={
code=function(arg) code=function(arg)
--Check arguments --Check arguments
arg=STRING.split(arg," ") arg=arg:split(" ")
if #arg>2 then if #arg>2 then
log{C.lY,"Warning: file names must have no spaces"} log{C.lY,"Warning: file names must have no spaces"}
return return
@@ -867,7 +867,7 @@ local commands={}do
--Network --Network
commands.switchhost={ commands.switchhost={
code=function(arg) code=function(arg)
arg=STRING.split(arg," ") arg=arg:split(" ")
if arg[1]and #arg<=3 then if arg[1]and #arg<=3 then
WS.switchHost(unpack(arg)) WS.switchHost(unpack(arg))
log{C.Y,"Host switched"} log{C.Y,"Host switched"}

View File

@@ -103,7 +103,7 @@ function scene.keyDown(key,isRep)
MES.new('check',text.exportSuccess) MES.new('check',text.exportSuccess)
elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then
local str=sys.getClipboardText() local str=sys.getClipboardText()
local args=STRING.split(str:sub((str:find(":")or 0)+1),"!") local args=str:sub((str:find(":")or 0)+1):split("!")
if #args<4 then goto THROW_fail end if #args<4 then goto THROW_fail end
if not( if not(
DATA.pasteQuestArgs(args[1])and DATA.pasteQuestArgs(args[1])and

View File

@@ -2,7 +2,7 @@ local scene={}
function scene.sceneInit() function scene.sceneInit()
BG.set('cubes') BG.set('cubes')
WIDGET.active.texts:setTexts(STRING.split(require"parts.updateLog","\n")) WIDGET.active.texts:setTexts(require"parts.updateLog":split("\n"))
end end
function scene.wheelMoved(_,y) function scene.wheelMoved(_,y)

View File

@@ -3,7 +3,7 @@ function scene.sceneInit()
BG.set('cubes') BG.set('cubes')
local fileData=love.filesystem.read("legals.md") local fileData=love.filesystem.read("legals.md")
if fileData then if fileData then
WIDGET.active.texts:setTexts(STRING.split(fileData,'\n')) WIDGET.active.texts:setTexts(fileData:split('\n'))
else else
WIDGET.active.texts:setTexts{"[legals.md not found]"} WIDGET.active.texts:setTexts{"[legals.md not found]"}
end end

View File

@@ -4,7 +4,7 @@ function scene.sceneInit()
BG.set('cubes') BG.set('cubes')
local fileData=love.filesystem.read('parts/language/manual_'..(SETTING.locale:find'zh'and'zh'or'en')..'.txt') local fileData=love.filesystem.read('parts/language/manual_'..(SETTING.locale:find'zh'and'zh'or'en')..'.txt')
if fileData then if fileData then
WIDGET.active.texts:setTexts(STRING.split(fileData,'\n')) WIDGET.active.texts:setTexts(fileData:split('\n'))
else else
WIDGET.active.texts:setTexts{"[manual file not found]"} WIDGET.active.texts:setTexts{"[manual file not found]"}
end end