Package list lua-ldoc / 7bb95e5
issue #78 default parm value now in documentation Steve Donovan 8 years ago
2 changed file(s) with 21 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
751751 return '('..table.concat(buffer)..')'
752752 end
753753
754 function Item:type_of_param(p)
754 function Item:param_modifiers (p)
755755 local mods = self.modifiers[self.parameter]
756756 if not mods then return '' end
757 local mparam = rawget(mods,p)
757 return rawget(mods,p)
758 end
759
760 function Item:type_of_param(p)
761 local mparam = self:param_modifiers(p)
758762 return mparam and mparam.type or ''
763 end
764
765 function Item:default_of_param(p)
766 local m = self:param_modifiers(p)
767 if not m then return nil end
768 local opt = m.optchain or m.opt
769 if opt == true then return nil end
770 return opt
759771 end
760772
761773 function Item:type_of_ret(idx)
164164 <ul>
165165 # end
166166 # for p in iter(param) do
167 # local name,tp = item:display_name_of(p), ldoc.typename(item:type_of_param(p))
167 # local name,tp,def = item:display_name_of(p), ldoc.typename(item:type_of_param(p)), item:default_of_param(p)
168168 <li><span class="parameter">$(name)</span>
169169 # if tp ~= '' then
170170 <span class="types">$(tp)</span>
171 # end
172 $(M(item.params[p],item))</li>
171 # end
172 $(M(item.params[p],item))
173 # if def then
174 (<em>default</em> $(def))
175 # end
176 </li>
173177 # end
174178 # if sublist then
175179 </li></ul>