summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2015-03-11 17:28:09 +0100
committerWuzzy <almikes@aol.com>2015-03-11 17:28:09 +0100
commit944a357adfd53fd5a1bba19d64b7ef057b21ceeb (patch)
tree749c87a9e4d3fe83d5afc2dcf76dbe6688e08acf
parentccb771db0c018099b8f1691eb99ec326513e8d2a (diff)
Fix empty entry lists
-rw-r--r--init.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 9ae9f8a..73a2be3 100644
--- a/init.lua
+++ b/init.lua
@@ -82,10 +82,14 @@ function doc.formspec_category(id)
formstring = "label[0,0;Current help topic: "..doc.data.categories[id].def.name.."]"
formstring = formstring .. "label[0,0.5;Available entries:]"
formstring = formstring .. "textlist[0,1;11,7;doc_catlist;"
+ local counter = 0
for eid,entry in pairs(doc.data.categories[id].entries) do
formstring = formstring .. entry.name .. ","
+ counter = counter + 1
+ end
+ if counter >= 1 then
+ formstring = string.sub(formstring, 1, #formstring-1)
end
- formstring = string.sub(formstring, 1, #formstring-1)
formstring = formstring .. "]"
formstring = formstring .. "button[0,8;3,1;doc_button_goto_entry;Show entry]"
end