mirror of
https://github.com/love2d/love.git
synced 2026-08-19 12:14:20 +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 = {}
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user