Fix incorrect category counting
This commit is contained in:
parent
26cc48a1b2
commit
502103acc9
4
init.lua
4
init.lua
@ -48,6 +48,7 @@ doc.data = {}
|
|||||||
doc.data.categories = {}
|
doc.data.categories = {}
|
||||||
-- Default order (includes categories of other mods from the Docuentation System modpack)
|
-- Default order (includes categories of other mods from the Docuentation System modpack)
|
||||||
doc.data.category_order = {"basics", "nodes", "tools", "craftitems", "advanced"}
|
doc.data.category_order = {"basics", "nodes", "tools", "craftitems", "advanced"}
|
||||||
|
doc.data.category_count = 0
|
||||||
doc.data.players = {}
|
doc.data.players = {}
|
||||||
|
|
||||||
-- Space for additional APIs
|
-- Space for additional APIs
|
||||||
@ -81,6 +82,7 @@ function doc.new_category(id, def)
|
|||||||
else
|
else
|
||||||
doc.data.categories[id].order_position = order_id
|
doc.data.categories[id].order_position = order_id
|
||||||
end
|
end
|
||||||
|
doc.data.category_count = doc.data.category_count + 1
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return false
|
return false
|
||||||
@ -336,7 +338,7 @@ end
|
|||||||
|
|
||||||
-- Returns number of categories
|
-- Returns number of categories
|
||||||
function doc.get_category_count()
|
function doc.get_category_count()
|
||||||
return #doc.data.category_order
|
return doc.data.category_count
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns number of entries in category
|
-- Returns number of entries in category
|
||||||
|
Loading…
x
Reference in New Issue
Block a user