From 13b3943455a83acf0073f9f021a91ac28714a5e8 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sun, 27 Jun 2021 18:11:16 -0400 Subject: [PATCH] Made sure ARGS worked backwards-compatibly. --- data/core/start.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/core/start.lua b/data/core/start.lua index 5e0ff4bc..b76aefee 100644 --- a/data/core/start.lua +++ b/data/core/start.lua @@ -22,9 +22,9 @@ package.path = USERDIR .. '/?/init.lua;' .. package.path local function arg_error(error) io.stderr:write(ARGV[1] .. ": " .. error .. "\n") os.exit(-1) end -- returns a lua table with both numeric and non-numeric keys like getoptlong local function parse_args_to_dict_and_array(argv, t) - local options, arg = {} + local options, arg = { argv[1] } local function parse_value(value) - if t[arg] == "i" and not tonumber(value) then + if t[arg] == "i" and not tonumber(value) or (#t[arg] and #value == 0) then arg_error("error parsing argument " .. value) end options[arg], arg = t[arg] == "i" and tonumber(value) or value, nil