From 63fed60eaaf8026194068cb32f4a03c59831a0d6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 3 Aug 2017 03:21:39 +0200 Subject: [PATCH] Fix crash caused by _mcl_shears_drop factoid --- mods/HELP/mcl_doc/init.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/mods/HELP/mcl_doc/init.lua b/mods/HELP/mcl_doc/init.lua index ba959927df..bd256da98e 100644 --- a/mods/HELP/mcl_doc/init.lua +++ b/mods/HELP/mcl_doc/init.lua @@ -187,13 +187,21 @@ doc.sub.items.register_factoid("nodes", "drops", function(itemstring, def) return "This block drops itself when mined by shears." elseif type(def._mcl_shears_drop) == "table" then local drops = {} - for i=1, #def._mcl_shears_drop do - local desc = minetest.registered_items[def._mcl_shears_drop[i]].description - if desc then - table.insert(drops) + for d=1, #def._mcl_shears_drop do + local item = ItemStack(def._mcl_shears_drop[d]) + local itemname = item:get_name() + local itemcount = item:get_count() + local idef = minetest.registered_items[itemname] + local text = "" + if idef.description and idef.description ~= "" then + text = idef.description else - table.insert(def._mcl_shears_drop[i]) + text = itemname end + if itemcount > 1 then + text = string.format("%d×%s", itemcount, text) + end + table.insert(drops, text) end local ret = string.format("This blocks drops the following when mined by shears: %s", table.concat(drops, ", ")) return ret