From 24569c37d39431a450206acc35c5ae627677f7da Mon Sep 17 00:00:00 2001 From: VorTechnix <45538536+VorTechnix@users.noreply.github.com> Date: Fri, 23 Jul 2021 13:13:47 -0700 Subject: [PATCH] fixed single nodename crash --- .../commands/wireframe/wcompass.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/worldeditadditions_commands/commands/wireframe/wcompass.lua b/worldeditadditions_commands/commands/wireframe/wcompass.lua index 5a62b1e..ba012c8 100644 --- a/worldeditadditions_commands/commands/wireframe/wcompass.lua +++ b/worldeditadditions_commands/commands/wireframe/wcompass.lua @@ -11,23 +11,22 @@ worldedit.register_command("wcompass", { require_pos = 1, parse = function(params_text) local parts = wea.split(params_text," ",true) + if not parts[1] then + return false, "Error: too few arguments! Expected: \" []\"" + elseif not parts[2] then + parts[2] = parts[1] + end local node1 = worldedit.normalize_nodename(parts[1]) local node2 = worldedit.normalize_nodename(parts[2]) if not node1 then return false, "Invalid : " .. parts[1] - elseif parts[2] and not node2 then + elseif not node2 then return false, "Invalid : " .. parts[2] - elseif not parts[2] then - node2 = node1 end return true, node1, node2 end, nodes_needed = function(name) - local p1, p2, total = worldedit.pos1[name], worldedit.pos2[name], 1 - for k,v in pairs({"x","y","z"}) do - if p1[v] ~= p2[v] then total = total*2 end - end - return total + return 26 end, func = function(name, node1, node2) local _, count = wea.make_compass(worldedit.pos1[name], node1, node2)