Replace `table.getn with # and scene with SCENE`

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-04-19 21:23:09 +07:00
parent cedc6e888e
commit 9c8628a014
13 changed files with 67 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
local ConfigScene = Scene:extend()
local ConfigScene = SCENE:extend()
ConfigScene.title = "Input Config"
@@ -39,13 +39,13 @@ function ConfigScene:render()
end
function ConfigScene:changeOption(rel)
local len = table.getn(menu_screens)
local len = #menu_screens
self.menu_state = (self.menu_state + len + rel - 1) % len + 1
end
function ConfigScene:onInputPress(e)
if e.input == "menu_decide" or e.input == "rotate_left" or e.scancode == "return" then
scene = menu_screens[self.menu_state]()
SCENE = menu_screens[self.menu_state]()
elseif e.input == "up" or e.scancode == "up" then
self:changeOption(-1)
elseif e.input == "down" or e.scancode == "down" then
@@ -53,7 +53,7 @@ function ConfigScene:onInputPress(e)
elseif config.input and (
e.input == "menu_back" or e.input == "rotate_right" or e.scancode == "backspace" or e.scancode == "delete"
) then
scene = TitleScene()
SCENE = TitleScene()
end
end