From 944a357adfd53fd5a1bba19d64b7ef057b21ceeb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 11 Mar 2015 17:28:09 +0100 Subject: Fix empty entry lists --- init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3