|
|
@ -167,11 +167,11 @@ function numberList(arg, arg_name, list_length)
|
|
|
|
return strings
|
|
|
|
return strings
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- throws if val is not a positive integer; otherwise returns val
|
|
|
|
-- throws if val is not a nonnegative integer; otherwise returns val
|
|
|
|
local function check_positive_int(val, arg_name)
|
|
|
|
local function check_nonnegative_int(val, arg_name)
|
|
|
|
if not val or val <= 0 or val ~= math.floor(val) then
|
|
|
|
if not val or val < 0 or val ~= math.floor(val) then
|
|
|
|
arg_error(arg_name,
|
|
|
|
arg_error(arg_name,
|
|
|
|
'expected positive integer; got "%s"', tostring(val))
|
|
|
|
'expected non-negative integer; got "%s"', tostring(val))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return val
|
|
|
|
return val
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -190,9 +190,9 @@ function coords(arg, arg_name)
|
|
|
|
return cursor
|
|
|
|
return cursor
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local numbers = numberList(arg, arg_name, 3)
|
|
|
|
local numbers = numberList(arg, arg_name, 3)
|
|
|
|
return xyz2pos(check_positive_int(numbers[1]),
|
|
|
|
return xyz2pos(check_nonnegative_int(numbers[1]),
|
|
|
|
check_positive_int(numbers[2]),
|
|
|
|
check_nonnegative_int(numbers[2]),
|
|
|
|
check_positive_int(numbers[3]))
|
|
|
|
check_nonnegative_int(numbers[3]))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return _ENV
|
|
|
|
return _ENV
|
|
|
|