File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 17
17
18
18
-- determines whether `nodename` is a valid node name, returning a boolean
19
19
worldedit .normalize_nodename = function (nodename )
20
- if minetest .registered_nodes [nodename ] then -- directly found node name
21
- return nodename
22
- elseif minetest .registered_nodes [" default:" .. nodename ] then -- found node name in default
23
- return " default:" .. nodename
20
+ local fullname = ItemStack ({name = nodename }):get_name () -- resolve aliases of node names to full names
21
+ if minetest .registered_nodes [fullname ] then -- directly found node name or alias of nodename
22
+ return fullname
24
23
end
25
24
for key , value in pairs (minetest .registered_nodes ) do
26
25
if key :find (" :" .. nodename , 1 , true ) then -- found in mod
27
26
return key
28
27
end
29
28
end
29
+ nodename = nodename :lower () -- lowercase both for case insensitive comparison
30
30
for key , value in pairs (minetest .registered_nodes ) do
31
- if value .description :lower () == nodename : lower () then -- found in description
31
+ if value .description :lower () == nodename then -- found in description
32
32
return key
33
33
end
34
34
end
You can’t perform that action at this time.
0 commit comments