mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
love.arg.parse_option just return how many extra arg the current option consumes.
--HG-- branch : better-parse-options
This commit is contained in:
@@ -122,11 +122,10 @@ function love.arg.parse_option(m, i)
|
||||
m.arg = {}
|
||||
for j=i,i+m.a-1 do
|
||||
table.insert(m.arg, arg[j])
|
||||
i = j
|
||||
end
|
||||
end
|
||||
|
||||
return i
|
||||
return m.a
|
||||
end
|
||||
|
||||
function love.arg.parse_options()
|
||||
@@ -140,7 +139,7 @@ function love.arg.parse_options()
|
||||
local m = string.match(arg[i], "^%-%-(.+)")
|
||||
|
||||
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
|
||||
game = i
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user