From bd524aabf1b97d3db27c3581e82ae29098e89a04 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Fri, 5 Sep 2025 21:50:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(chest=5Fsorter):=20=E5=B0=86=E4=B8=BB?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=94=B9=E4=B8=BA=E5=8F=AF=E5=8F=98=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=B9=B6=E4=BC=98=E5=8C=96=E5=8F=82=E6=95=B0=E6=A3=80?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用可变参数函数提高灵活性,同时将参数解构到局部变量中避免重复计算 --- data/computercraft/lua/rom/programs/chest_sorter.lua | 5 +++-- installer.lua | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data/computercraft/lua/rom/programs/chest_sorter.lua b/data/computercraft/lua/rom/programs/chest_sorter.lua index da88512..e3bf0c2 100644 --- a/data/computercraft/lua/rom/programs/chest_sorter.lua +++ b/data/computercraft/lua/rom/programs/chest_sorter.lua @@ -237,9 +237,10 @@ local function showTutorial() end -- 主程序 -local function main() +local function main(...) -- 改为可变参数函数 -- 检查是否需要显示教程 - if #({...}) > 0 and ({...})[1] == "tutorial" then + local args = {...} + if #args > 0 and args[1] == "tutorial" then showTutorial() return end diff --git a/installer.lua b/installer.lua index 502d91b..6a32f75 100644 --- a/installer.lua +++ b/installer.lua @@ -1,5 +1,5 @@ -- LeonOS installer -local INSTALLER_VERSION = "0.3.8 Beta 18" +local INSTALLER_VERSION = "0.3.8 Beta 19" local DEFAULT_ROM_DIR = "/leonos" print("Start loading LeonOS installer ("..INSTALLER_VERSION..")...")