diff options
author | Wuzzy <almikes@aol.com> | 2016-08-01 04:46:43 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-01 04:46:43 +0200 |
commit | daa4294fb0cddc59ad190be1ccc9aba63fb01707 (patch) | |
tree | be0e8b5cbc8b1c5d8d4c7f9d05a88434b43636b6 | |
parent | 3f27c60af634387b8afcc9746bc3c363436f4837 (diff) |
Unify desc and usagehelp
-rw-r--r-- | init.lua | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -459,8 +459,8 @@ doc.new_category("tools", { name = "Tools and weapons", build_formspec = function(data) if data then - local longdesc = data.longdesc or "N/A" - local usagehelp = data.usagehelp or "N/A" + local longdesc = data.longdesc + local usagehelp = data.usagehelp local formstring = "" -- Hand if data.itemstring == "" then @@ -469,8 +469,13 @@ doc.new_category("tools", { else formstring = formstring .. "item_image[11,0;1,1;"..data.itemstring.."]" end - formstring = formstring .. "textarea[0.25,1;10,8;;Description: "..minetest.formspec_escape(longdesc).."\n\n" - formstring = formstring .. "Usage: "..minetest.formspec_escape(usagehelp).. "\n\n" + formstring = formstring .. "textarea[0.25,1;10,8;;" + if longdesc ~= nil then + formstring = formstring .. "Description: "..minetest.formspec_escape(longdesc).."\n\n" + end + if usagehelp ~= nil then + formstring = formstring .. "Usage help: "..minetest.formspec_escape(usagehelp).. "\n\n" + end formstring = formstring .. "Maximum stack size: "..data.def.stack_max.. "\n" local yesno = function(bool) @@ -524,11 +529,16 @@ doc.new_category("craftitems", { name = "Miscellaneous items", build_formspec = function(data) if data then - local longdesc = data.longdesc or "N/A" - local usagehelp = data.usagehelp or "N/A" + local longdesc = data.longdesc + local usagehelp = data.usagehelp local formstring = "item_image[11,0;1,1;"..data.itemstring.."]" - formstring = formstring .. "textarea[0.25,1;10,8;;Description: "..minetest.formspec_escape(longdesc).."\n\n" - formstring = formstring .. "Usage: "..minetest.formspec_escape(usagehelp).. "\n\n" + formstring = formstring .. "textarea[0.25,1;10,8;;" + if longdesc ~= nil then + formstring = formstring .. "Description: "..minetest.formspec_escape(longdesc).."\n\n" + end + if usagehelp ~= nil then + formstring = formstring .. "Usage help: "..minetest.formspec_escape(usagehelp).. "\n\n" + end formstring = formstring .. "Maximum stack size: "..data.def.stack_max.. "\n" local yesno = function(bool) |