From fce3ee4e44de05bb59aed12accdd7d5f8de9e8fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 11 Oct 2021 20:10:54 +0800 Subject: update bootstrap --- make/bootstrap.lua | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'make') diff --git a/make/bootstrap.lua b/make/bootstrap.lua index 42e34890..b29fa03e 100644 --- a/make/bootstrap.lua +++ b/make/bootstrap.lua @@ -1,23 +1,21 @@ +local args = {} +local main = 'main.lua' + local i = 1 -while true do +while arg[i] do if arg[i] == '-E' then elseif arg[i] == '-e' then i = i + 1 local expr = assert(arg[i], "'-e' needs argument") assert(load(expr, "=(command line)"))() + elseif arg[i]:sub(1, 1) == '-' then + args[#args+1] = arg[i] else - break + main = arg[i] end i = i + 1 end -for j = -1, #arg do - arg[j - i] = arg[j] -end -for j = #arg - i + 1, #arg do - arg[j] = nil -end - local root; do local sep = package.config:sub(1,1) if sep == '\\' then @@ -35,5 +33,4 @@ package.path = table.concat({ root .. "/script/?/init.lua", }, ";") -local main = arg[0] or 'main.lua' -assert(loadfile(main))(table.unpack(arg)) +assert(loadfile(main))(table.unpack(args)) -- cgit v1.2.3