Item name HUD: Show itemstring as fallback

This commit is contained in:
Wuzzy 2017-06-05 22:47:50 +02:00
parent 4afb2d4066
commit d497205c98

View File

@ -40,7 +40,11 @@ minetest.register_globalstep(function(dtime)
dtimes[player_name] = 0 dtimes[player_name] = 0
if huds[player_name] then if huds[player_name] then
local def = minetest.registered_items[wstack] local def = minetest.registered_items[wstack]
local desc = def and def.description or "" local desc = def and def.description
if not desc or desc == "" then
-- Use itemstring as fallback
desc = wstack
end
-- Cut off item description after first newline -- Cut off item description after first newline
local firstnewline = string.find(desc, "\n") local firstnewline = string.find(desc, "\n")
if firstnewline then if firstnewline then