Gracefully fail when trying to parse unknown item
This commit is contained in:
parent
094f13607a
commit
7f40f3404a
5
init.lua
5
init.lua
@ -104,6 +104,11 @@ end
|
||||
|
||||
-- Extract suitable item description for formspec
|
||||
local description_for_formspec = function(itemstring)
|
||||
if minetest.registered_items[itemstring] == nil then
|
||||
-- Huh? The item doesn't exist for some reason. Better give a dummy string
|
||||
minetest.log("warning", "[doc] Unknown item detected: "..tostring(itemstring))
|
||||
return S("Unknown item (@1)", tostring(itemstring))
|
||||
end
|
||||
local description = minetest.registered_items[itemstring].description
|
||||
if description == nil or description == "" then
|
||||
return minetest.formspec_escape(itemstring)
|
||||
|
@ -121,6 +121,7 @@ any level = beliebige Stufe
|
||||
level 0 = Stufe 0
|
||||
level 0-%d = Stufen 0-%d
|
||||
unknown = unbekannt
|
||||
Unknown item (@1) = Unbekannter Gegenstand (@1)
|
||||
• %s: %d = • %s: %d
|
||||
• %s: %d HP = • %s: %d TP
|
||||
• %s: %s, %s = • %s: %s, %s
|
||||
|
@ -121,6 +121,7 @@ any level =
|
||||
level 0 =
|
||||
level 0-%d =
|
||||
unknown =
|
||||
Unknown item (@1) =
|
||||
• %s: %d =
|
||||
• %s: %d HP =
|
||||
• %s: %s, %s =
|
||||
|
Loading…
x
Reference in New Issue
Block a user