summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorDS <vorunbekannt75@web.de>2020-10-09 20:11:21 +0200
committerGitHub <noreply@github.com>2020-10-09 19:11:21 +0100
commitf3ae45b2b245dd0aeb4a7d9b76afaf078871104c (patch)
treef9b0e27043bbe8f2b16e6f4917f6b9a92f273345 /builtin
parentb2f3f663858e6d2a2174066e425bb6f2edea910b (diff)
downloadminetest-f3ae45b2b245dd0aeb4a7d9b76afaf078871104c.tar.gz
minetest-f3ae45b2b245dd0aeb4a7d9b76afaf078871104c.tar.bz2
minetest-f3ae45b2b245dd0aeb4a7d9b76afaf078871104c.zip
Add a short_description to be used by mods (#8980)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/register.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index 3de67c04b..f00b76494 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -118,6 +118,12 @@ function core.register_item(name, itemdef)
end
itemdef.name = name
+ -- default description to item name
+ itemdef.description = itemdef.description or name
+ -- default short_description to first line of description
+ itemdef.short_description = itemdef.short_description or
+ itemdef.description:gsub("\n.*","")
+
-- Apply defaults and add to registered_* table
if itemdef.type == "node" then
-- Use the nodebox as selection box if it's not set manually