# HG changeset patch # User Matthew Wild # Date 1650895781 -3600 # Node ID 553c6204fe5b40a731c81d370b42917dfee37530 # Parent 8fac328101441784e1d0f6f6f87fc1d84779b74b util.argparse: Return final 'arg' table with positional arguments for convenience This is the same as the input table (which is mutated during processing), but if that table was created on the fly, such as by packing `...` it's convenient if it also gets returned from the parse function. diff -r 8fac32810144 -r 553c6204fe5b util/argparse.lua --- a/util/argparse.lua Mon Apr 25 15:07:49 2022 +0100 +++ b/util/argparse.lua Mon Apr 25 15:09:41 2022 +0100 @@ -5,7 +5,7 @@ local parsed_opts = {}; if #arg == 0 then - return parsed_opts; + return parsed_opts, arg; end while true do local raw_param = arg[1]; @@ -47,7 +47,7 @@ end parsed_opts[param_k] = param_v; end - return parsed_opts; + return parsed_opts, arg; end return {