整理代码(主要清除所有redefine-local)

This commit is contained in:
MrZ626
2020-10-30 00:01:51 +08:00
parent 1d34b22456
commit 894c17b4c0
13 changed files with 82 additions and 85 deletions

View File

@@ -52,17 +52,17 @@ local swap={
none={1,0,NULL},--swapTime, changeTime, drawFunction
flash={8,1,function()gc.clear(1,1,1)end},
fade={30,15,function(t)
local t=t>15 and 2-t/15 or t/15
t=t>15 and 2-t/15 or t/15
gc.setColor(0,0,0,t)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
end},
fade_togame={120,20,function(t)
local t=t>20 and(120-t)/100 or t/20
t=t>20 and(120-t)/100 or t/20
gc.setColor(0,0,0,t)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
end},
slowFade={180,90,function(t)
local t=t>90 and 2-t/90 or t/90
t=t>90 and 2-t/90 or t/90
gc.setColor(0,0,0,t)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
end},

View File

@@ -208,7 +208,7 @@ do--json
-- SOFTWARE.
--
local chr=string.char
local char=string.char
json = {}
-------------------------------------------------------------------------------
@@ -343,14 +343,14 @@ do--json
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
local f = math.floor
if n <= 0x7f then
return chr(n)
return char(n)
elseif n <= 0x7ff then
return chr(f(n / 64) + 192, n % 64 + 128)
return char(f(n / 64) + 192, n % 64 + 128)
elseif n <= 0xffff then
return chr(f(n / 4096) + 224, f(n % 4096 / 64) + 128,
return char(f(n / 4096) + 224, f(n % 4096 / 64) + 128,
n % 64 + 128)
elseif n <= 0x10ffff then
return chr(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
return char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
f(n % 4096 / 64) + 128, n % 64 + 128)
end
error(string.format("invalid unicode codepoint '%x'", n))

View File

@@ -46,12 +46,12 @@ function VOC.loadAll()
end
function VOC.getFreeChannel()
local i=#voiceQueue
for i=1,i do
local l=#voiceQueue
for i=1,l do
if #voiceQueue[i]==0 then return i end
end
voiceQueue[i+1]={s=0}
return i+1
voiceQueue[l+1]={s=0}
return l+1
end
function VOC.getCount()
return #voiceQueue
@@ -92,8 +92,8 @@ function VOC.update()
end
elseif Q.s==3 then--Playing 12 same time
if not Q[1]:isPlaying()then
for i=1,#Q do
Q[i]=Q[i+1]
for j=1,#Q do
Q[j]=Q[j+1]
end
Q.s=Q[2]and 2 or 4
end

View File

@@ -384,8 +384,8 @@ function slider:draw()
if not self.smooth then
gc.setLineWidth(2)
for p=0,self.unit do
local x=x+(x2-x)*p/self.unit
gc.line(x,y+7,x,y-7)
local X=x+(x2-x)*p/self.unit
gc.line(X,y+7,X,y-7)
end
end
@@ -731,8 +731,8 @@ function WIDGET.press(x,y)
end
elseif W.type=="textBox"then
if MOBILE then
local _,y=xOy:transformPoint(0,W.y+W.h)
kb.setTextInput(true,0,y,1,1)
local _,y1=xOy:transformPoint(0,W.y+W.h)
kb.setTextInput(true,0,y1,1,1)
end
end
if W.hide and W.hide()then WIDGET.sel=nil end