Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix //mix and improve normalize_nodename.
  • Loading branch information
Uberi committed Jul 18, 2014
1 parent 4b178bf commit 38fbc0a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion worldedit_commands/init.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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 .. "\"")
Expand Down

0 comments on commit 38fbc0a

Please sign in to comment.