convolve: fix minor chat command issues

This commit is contained in:
Starbeamrainbowlabs 2020-06-10 01:06:34 +01:00
parent d96f169950
commit 2b32385fdf
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -9,9 +9,7 @@ worldedit.register_command("convolve", {
privs = { worldedit = true }, privs = { worldedit = true },
require_pos = 2, require_pos = 2,
parse = function(params_text) parse = function(params_text)
if not params_text or params_text == "" then if not params_text then params_text = "" end
return false, "Error: No arguments specified"
end
local parts = worldeditadditions.split(params_text, "%s+", false) local parts = worldeditadditions.split(params_text, "%s+", false)
@ -20,7 +18,7 @@ worldedit.register_command("convolve", {
local height = 5 local height = 5
local sigma = nil local sigma = nil
if #parts >= 1 then if #parts >= 1 and #parts[1] > 0 then
kernel_name = parts[1] kernel_name = parts[1]
end end
if #parts >= 2 then if #parts >= 2 then
@ -31,7 +29,7 @@ worldedit.register_command("convolve", {
return false, "Error: Invalid width (it must be a positive odd integer)." return false, "Error: Invalid width (it must be a positive odd integer)."
end end
if #parts_dimension >= 2 then if #parts_dimension >= 2 then
height = tonumber(parts[2]) height = tonumber(parts_dimension[2])
if not height then if not height then
return false, "Error: Invalid height (it must be a positive odd integer)." return false, "Error: Invalid height (it must be a positive odd integer)."
end end