summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-10-07 06:15:42 +0200
committerWuzzy <almikes@aol.com>2016-10-07 06:15:42 +0200
commit95ad337f52c0013fe64832482e72491fa54cbebe (patch)
tree3923bb0f88ada6f07d481204e638549e4584f233 /init.lua
parentbe4b437d4a704c2ef88f894a4007eedb6a88dc72 (diff)
doc.get_hidden_count
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 321c7d8..522d037 100644
--- a/init.lua
+++ b/init.lua
@@ -258,6 +258,21 @@ function doc.get_revealed_count(playername, category_id)
end
end
+-- Returns how many entries are hidden from the player
+function doc.get_hidden_count(playername, category_id)
+ local playerdata = doc.data.players[playername]
+ if playerdata == nil then
+ return nil
+ end
+ local total = doc.get_entry_count(category_id)
+ local rcount = playerdata.stored_data.revealed_count[category_id]
+ if rcount == nil then
+ return total
+ else
+ return total - rcount
+ end
+end
+
-- Template function templates, to be used for build_formspec in doc.new_category
doc.entry_builders = {}