diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-10-11 20:10:54 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-10-11 20:10:54 +0800 |
commit | fce3ee4e44de05bb59aed12accdd7d5f8de9e8fa (patch) | |
tree | cfc7b07ddafabb440b371a8871254d0742ece0e8 /make/bootstrap.lua | |
parent | c7937d65b7830412b809e5dcbad72f44a9f0110e (diff) | |
download | lua-language-server-fce3ee4e44de05bb59aed12accdd7d5f8de9e8fa.zip |
update bootstrap
Diffstat (limited to 'make/bootstrap.lua')
-rw-r--r-- | make/bootstrap.lua | 19 |
1 files changed, 8 insertions, 11 deletions
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))
|