\r
//expand right 7 5\r
\r
-### `//outset [h|v] <amount>`\r
+### `//outset [hv] <amount>`\r
\r
Expands the selection in all directions by `<amount>`. If specified, the selection can be expanded horizontally in the x and z axes `[h]`\r
or vertically in the y axis `[v]`.\r
\r
//outset v 5\r
\r
-### `//inset [h|v] <amount>`\r
+### `//inset [hv] <amount>`\r
\r
Contracts the selection in all directions by `<amount>`. If specified, the selection can be contracted horizontally in the x and z axes `[h]`\r
or vertically in the y axis `[v]`.\r
description = "outset the selection",
privs = {worldedit=true},
func = function(name, param)
- local find, _, dir, amount = param:find("([hv]?)%s*([+-]?%d+)")
+ local find, _, dir, amount = param:find("(%a*)%s*([+-]?%d+)")
if find == nil then
return false, "invalid usage: " .. param
"Undefined region. Region must be defined beforehand."
end
- if dir == "" then
+ local hv_test = dir:find("[^hv]+")
+
+ if hv_test ~= nil then
+ return false, "Invalid direction."
+ end
+
+ if dir == "" or dir == "hv" or dir == "vh" then
assert(worldedit.cuboid_volumetric_expand(name, amount))
elseif dir == "h" then
assert(worldedit.cuboid_linear_expand(name, 'x', 1, amount))
assert(worldedit.cuboid_linear_expand(name, 'y', 1, amount))
assert(worldedit.cuboid_linear_expand(name, 'y', -1, amount))
else
- return false, "Unknown error"
+ return false, "Invalid number of arguments"
end
worldedit.marker_update(name)
description = "inset the selection",
privs = {worldedit=true},
func = function(name, param)
- local find, _, dir, amount = param:find("([hv]?)%s*([+-]?%d+)")
+ local find, _, dir, amount = param:find("(%a*)%s*([+-]?%d+)")
if find == nil then
return false, "invalid usage: " .. param
"Undefined region. Region must be defined beforehand."
end
- if dir == "" then
+ local hv_test = dir:find("[^hv]+")
+
+ if hv_test ~= nil then
+ return false, "Invalid direction."
+ end
+
+ if dir == "" or dir == "vh" or dir == "hv" then
assert(worldedit.cuboid_volumetric_expand(name, -amount))
elseif dir == "h" then
assert(worldedit.cuboid_linear_expand(name, 'x', 1, -amount))
assert(worldedit.cuboid_linear_expand(name, 'y', 1, -amount))
assert(worldedit.cuboid_linear_expand(name, 'y', -1, -amount))
else
- return false, "Unknown error"
+ return false, "Invalid number of arguments"
end
worldedit.marker_update(name)