diff options
author | Wuzzy <almikes@aol.com> | 2016-08-01 05:36:50 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-01 05:36:50 +0200 |
commit | db3ecde0882c6cde9f24b41aba1fb42af8a1408c (patch) | |
tree | f1f2b9ec09a26fcaeecf055b706c5ca8c02bad63 | |
parent | 73bf1e08bb86843a20fd339e7c39ad716e854cc2 (diff) |
Sort categories (first come, first serve)
-rw-r--r-- | init.lua | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -9,6 +9,7 @@ doc.VERSION.STRING = doc.VERSION.MAJOR.."."..doc.VERSION.MINOR.."."..doc.VERSION doc.data = {} doc.data.categories = {} +doc.data.category_order = {} doc.data.players = {} -- Space for additional APIs @@ -23,6 +24,7 @@ function doc.new_category(id, def) doc.data.categories[id].entries = {} doc.data.categories[id].def = def doc.data.categories[id].entry_aliases = {} + table.insert(doc.data.category_order, id) return true else return false @@ -125,7 +127,9 @@ end function doc.formspec_main() local y = 1 local formstring = "label[0,0;Available help topics:]" - for id,data in pairs(doc.data.categories) do + for c=1,#doc.data.category_order do + local id = doc.data.category_order[c] + local data = doc.data.categories[id] local button = "button[0,"..y..";3,1;doc_button_category_"..id..";"..minetest.formspec_escape(data.def.name).."]" formstring = formstring .. button y = y + 1 |