diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 220f210..4038c4f 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -752,11 +752,23 @@ return '('..table.concat(buffer)..')' end -function Item:type_of_param(p) +function Item:param_modifiers (p) local mods = self.modifiers[self.parameter] if not mods then return '' end - local mparam = rawget(mods,p) + return rawget(mods,p) +end + +function Item:type_of_param(p) + local mparam = self:param_modifiers(p) return mparam and mparam.type or '' +end + +function Item:default_of_param(p) + local m = self:param_modifiers(p) + if not m then return nil end + local opt = m.optchain or m.opt + if opt == true then return nil end + return opt end function Item:type_of_ret(idx) diff --git a/ldoc/html/ldoc_ltp.lua b/ldoc/html/ldoc_ltp.lua index 0943f3c..08e03d6 100644 --- a/ldoc/html/ldoc_ltp.lua +++ b/ldoc/html/ldoc_ltp.lua @@ -165,12 +165,16 @@