From 1ebd14829155a1685d1a6ebd4c46a62054d5ef39 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Sun, 10 Apr 2016 16:54:33 +0200 Subject: [PATCH] allow [int] in table documentation - http://stackoverflow.com/questions/36419386/lua-ldoc-documentation-of-a-table --- ldoc/tools.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ldoc/tools.lua b/ldoc/tools.lua index 8b6d96a..54528d2 100644 --- a/ldoc/tools.lua +++ b/ldoc/tools.lua @@ -336,7 +336,12 @@ function M.get_parameters (tok,endtoken,delim,lang) return text:match("%s*%-%-+%s*(.*)") end extract_arg = function(tl,idx) - return value_of(tl[idx or 1]) + idx = idx or 1 + local res = value_of(tl[idx]) + if res == '[' then -- we do allow array indices in tables now + res = '['..value_of(tl[idx + 1])..']' + end + return res end end