diff options
author | Wuzzy <almikes@aol.com> | 2016-07-24 14:59:09 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-07-24 14:59:09 +0200 |
commit | 5e6675f3184f37caeee1a71a75b0cb88f711dc1f (patch) | |
tree | 0db5dcd342b704e6f1fec218de6859056349ac89 | |
parent | 65bc588cd7b06fd08688afde59c6387ce770e681 (diff) |
New function: doc.entry_exists
-rw-r--r-- | init.lua | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -60,6 +60,17 @@ function doc.show_entry(playername, category_id, entry_id) minetest.show_formspec(playername, "doc:entry", formspec) end +-- Returns true if and only if: +-- * The specified category exists +-- * This category contains the specified entry +function doc.entry_exists(category_id, entry_id) + if doc.data.categories[category_id] ~= nil then + return doc.data.categories[category_id].entries[entry_id] ~= nil + else + return false + end +end + --[[ Functions for internal use ]] function doc.formspec_core(tab) |