diff options
Diffstat (limited to 'make')
-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))
|