整理代码,使用TABLE.find

This commit is contained in:
MrZ626
2021-05-10 17:28:26 +08:00
parent f3eb95df93
commit fefa5433fd
10 changed files with 33 additions and 63 deletions

View File

@@ -273,12 +273,10 @@ function love.joystickadded(JS)
joysticks[#joysticks+1]=JS
end
function love.joystickremoved(JS)
for i=1,#joysticks do
if joysticks[i]==JS then
rem(joysticks,i)
LOG.print("Joystick removed",COLOR.Y)
return
end
local i=TABLE.find(joysticks,JS)
if i then
rem(joysticks,i)
LOG.print("Joystick removed",COLOR.Y)
end
end
local keyMirror={