love.arg.parse_option just return how many extra arg the current option consumes.

--HG--
branch : better-parse-options
This commit is contained in:
Xpol Wan
2016-11-04 22:27:49 +08:00
parent de855f30d5
commit c28a6c51c4
+2 -3
View File
@@ -122,11 +122,10 @@ function love.arg.parse_option(m, i)
m.arg = {} m.arg = {}
for j=i,i+m.a-1 do for j=i,i+m.a-1 do
table.insert(m.arg, arg[j]) table.insert(m.arg, arg[j])
i = j
end end
end end
return i return m.a
end end
function love.arg.parse_options() function love.arg.parse_options()
@@ -140,7 +139,7 @@ function love.arg.parse_options()
local m = string.match(arg[i], "^%-%-(.+)") local m = string.match(arg[i], "^%-%-(.+)")
if m and love.arg.options[m] then if m and love.arg.options[m] then
i = love.arg.parse_option(love.arg.options[m], i+1) i = i + love.arg.parse_option(love.arg.options[m], i+1)
elseif not game then elseif not game then
game = i game = i
end end