mirror of https://github.com/Hilbis/Hilbish
fix(doc): check if modmt exists before trying to get module prop docs
parent
dd678a4a75
commit
15035c02cb
|
@ -58,17 +58,19 @@ commander.register('doc', function(args)
|
||||||
local propstr = ''
|
local propstr = ''
|
||||||
local modDesc = ''
|
local modDesc = ''
|
||||||
local modmt = getmetatable(require(mod))
|
local modmt = getmetatable(require(mod))
|
||||||
modDesc = modmt.__doc
|
if modmt then
|
||||||
if modmt.__docProp then
|
modDesc = modmt.__doc
|
||||||
-- not all modules have docs for properties
|
if modmt.__docProp then
|
||||||
props = table.map(modmt.__docProp, function(v, k)
|
-- not all modules have docs for properties
|
||||||
return lunacolors.underline(lunacolors.blue(k)) .. ' > ' .. v
|
props = table.map(modmt.__docProp, function(v, k)
|
||||||
end)
|
return lunacolors.underline(lunacolors.blue(k)) .. ' > ' .. v
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if #props > 0 then
|
||||||
|
propstr = '\n# Properties\n' .. table.concat(props, '\n') .. '\n'
|
||||||
|
end
|
||||||
|
desc = string.format(modDocFormat, modDesc, propstr)
|
||||||
end
|
end
|
||||||
if #props > 0 then
|
|
||||||
propstr = '\n# Properties\n' .. table.concat(props, '\n') .. '\n'
|
|
||||||
end
|
|
||||||
desc = string.format(modDocFormat, modDesc, propstr)
|
|
||||||
end
|
end
|
||||||
print(desc .. formattedFuncs)
|
print(desc .. formattedFuncs)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
Loading…
Reference in New Issue