summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-30 21:35:10 +0200
committerWuzzy <almikes@aol.com>2016-08-30 21:35:10 +0200
commitc5573d1d267a8c67b77f6d6ae18f3f2bb1df6684 (patch)
tree57e6706bccf97fdaf899d0f39611f93d39678453 /init.lua
parentd172996451908b6b4cd986486fa0b96874ad0122 (diff)
API: get_category_definition, get_entry_definition
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 747871e..5eb9890 100644
--- a/init.lua
+++ b/init.lua
@@ -66,6 +66,22 @@ function doc.entry_viewed(playername, category_id, entry_id)
end
end
+-- Returns category definition
+function doc.get_category_definition(category_id)
+ if doc.data.categories[category_id] == nil then
+ return nil
+ end
+ return doc.data.categories[category_id].def
+end
+
+-- Returns entry definition
+function doc.get_entry_definition(category_id, entry_id)
+ if not doc.entry_exists(category_id, entry_id) then
+ return nil
+ end
+ return doc.data.categories[category_id].entries[entry_id]
+end
+
-- Opens the main documentation formspec for the player
function doc.show_doc(playername)
if doc.get_category_count() <= 0 then