From 41aceb83aa1ac0f65c85d9dc7bf50e17f128bce4 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sat, 20 Oct 2018 12:06:46 +0100 Subject: [PATCH] Fix issues form code review --- ChatCommands.md | 2 +- worldedit_commands/init.lua | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ChatCommands.md b/ChatCommands.md index 1b290f4..9672536 100644 --- a/ChatCommands.md +++ b/ChatCommands.md @@ -123,7 +123,7 @@ Set the param2 value of all nodes in the current WorldEdit region to ``. ### `//mix [] []...` -Fill the current WorldEdit region with a random mix of ``, ``, `...`. Weightings can be optionally spsecified via a number after a node name. +Fill the current WorldEdit region with a random mix of ``, ``, `...`. Weightings can be optionally specified via a number after a node name. //mix air //mix cactus stone glass sandstone diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index 84e9abc..46ff47d 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -431,11 +431,9 @@ minetest.register_chatcommand("/mix", { func = safe_region(function(name, param) local nodes = {} for nodename in param:gmatch("[^%s]+") do - if tonumber(nodename) ~= nil then + if tonumber(nodename) ~= nil and #nodes > 0 then local last_node = nodes[#nodes] local node_count = tonumber(nodename) - minetest.log("action", "last node: " .. last_node .. ", count: " .. node_count) - for i=1,node_count do nodes[#nodes + 1] = last_node end