Fix //mix and improve normalize_nodename.

This commit is contained in:
Uberi 2014-07-18 16:09:57 -04:00
parent 4b178bf709
commit 38fbc0a046
1 changed files with 2 additions and 1 deletions

View File

@ -38,6 +38,7 @@ end
--determines whether `nodename` is a valid node name, returning a boolean
worldedit.normalize_nodename = function(nodename)
nodename = nodename:gsub("^%s*(.-)%s*$", "%1")
if nodename == "" then return nil end
local fullname = ItemStack({name=nodename}):get_name() --resolve aliases of node names to full names
if minetest.registered_nodes[fullname] or fullname == "air" then --directly found node name or alias of nodename
@ -300,7 +301,7 @@ minetest.register_chatcommand("/mix", {
privs = {worldedit=true},
func = safe_region(function(name, param)
local nodes = {}
for nodename in param:gmatch("[^,]+") do
for nodename in param:gmatch("[^%s]+") do
local node = get_node(name, nodename)
if not node then
worldedit.player_notify(name, "Could not identify node \"" .. name .. "\"")