Make types optional in documentation generators.

This commit is contained in:
Florian Nücke
2022-01-26 02:40:47 +01:00
parent 0126c6e5f6
commit 557a1b1dc1
2 changed files with 14 additions and 4 deletions

View File

@@ -29,11 +29,17 @@ Device.__tostring = function(self)
else
doc = doc .. "arg" .. i
end
doc = doc .. ": " .. p.type
if p.type then
doc = doc .. ": " .. p.type
end
i = i + 1
end
end
doc = doc .. "): " .. method.returnType .. "\n"
doc = doc .. ")"
if method.returnType then
doc = doc .. ": " .. method.returnType
end
doc = doc .. "\n"
if method.description then
doc = doc .. method.description .. "\n"

View File

@@ -28,9 +28,13 @@ class Device:
doc += p["name"]
else:
doc += "arg" + str(i)
doc += ": " + p["type"]
if "type" in p:
doc += ": " + p["type"]
i += 1
doc += "): " + method["returnType"] + "\n"
doc += ")"
if "returnType" in method:
doc += ": " + method["returnType"]
doc += "\n"
if "description" in method and method["description"]:
doc += method["description"] + "\n"