From 1160a24a51bfa584806be2d2a894fc702cbf9dde Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 31 Aug 2025 20:47:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(wget):=20=E7=A1=AE=E4=BF=9Dfs=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=9C=A8=E8=BF=90=E8=A1=8C=E8=BF=9C=E7=A8=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=89=8D=E5=B7=B2=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加对fs模块的显式检查和加载,避免在运行远程代码时因fs模块未加载而导致的错误。 --- data/computercraft/lua/rom/programs/wget.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/computercraft/lua/rom/programs/wget.lua b/data/computercraft/lua/rom/programs/wget.lua index c8e4128..606b98b 100644 --- a/data/computercraft/lua/rom/programs/wget.lua +++ b/data/computercraft/lua/rom/programs/wget.lua @@ -5,6 +5,7 @@ if not package.loaded.http then end local http = require("http") +local fs = require("fs") local args = {...} @@ -30,6 +31,10 @@ end if args[1] == "run" then local data = get(args[2]) + -- 确保fs模块已加载 + if not _G.fs then + _G.fs = require("fs") + end assert(load(data, "=", "t", _G))() else local filename = args[2] or (args[1]:match("[^/]+$")) or