New function: doc.entry_exists
This commit is contained in:
parent
65bc588cd7
commit
5e6675f318
11
init.lua
11
init.lua
@ -60,6 +60,17 @@ function doc.show_entry(playername, category_id, entry_id)
|
|||||||
minetest.show_formspec(playername, "doc:entry", formspec)
|
minetest.show_formspec(playername, "doc:entry", formspec)
|
||||||
end
|
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 ]]
|
--[[ Functions for internal use ]]
|
||||||
|
|
||||||
function doc.formspec_core(tab)
|
function doc.formspec_core(tab)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user