summaryrefslogtreecommitdiffstats
path: root/src/lib/getopt.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/getopt.lua')
-rw-r--r--src/lib/getopt.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/getopt.lua b/src/lib/getopt.lua
index 91ce6cd..ede3e12 100644
--- a/src/lib/getopt.lua
+++ b/src/lib/getopt.lua
@@ -122,6 +122,9 @@ function Getopt:add(short, long, default, help, extensions)
elseif name == "" then
error("name (long|short) needs to be set")
end
+ if short and (type(short) ~= "string" or #short ~= 1) then
+ error("short needs to be a string of length 1")
+ end
if self._opt[name] then
error("option "..name.." alredy exists")