Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- --*nothing* default
- --simple
- --verbos
- --both (default and verbos)
- periphType = peripheral.getType(args[1])
- periph = peripheral.wrap(args[1])
- tableish = periph.getAdvancedMethodsData()
- if args[2] == "simple" then
- io.output(periphType.. "_simple_documentation.txt")
- elseif args[2] == "verbos" then
- io.output(periphType.. "_verbos_documentation.txt")
- elseif args[2] == "both" then
- io.output(periphType.. "_combined_documentation.txt")
- else
- io.output(periphType.. "_documentation.txt")
- end
- for k, v in pairs(tableish) do
- io.write(k.."()")
- i = 1
- if args[2] == "simple" then
- for l, b in pairs(v) do -- FOR 1 has 3 pairs
- --| returnTypes
- --| description
- --| args
- if i == 1 or i == 3 then
- for a, n in pairs(b) do -- FOR 2 has varying amount of pairs
- if i == 3 then
- if args[2] == "verbos" or args[2] == "both" then
- else
- if n["optional"] then
- io.write(n["type"].. " (".. n["name"].. ")")
- else
- io.write(n["type"].. " [".. n["name"].. "]")
- end
- io.write(", ")
- end
- end
- end
- end
- i = i+1
- end
- io.write(")")
- io.write("\n")
- else
- for l, b in pairs(v) do -- FOR 1 has 3 pairs
- --| returnTypes
- --| description
- --| args
- io.write("\n")
- if i == 1 or i == 3 then
- io.write(" "..l..":")
- for a, n in pairs(b) do -- FOR 2 has varying amount of pairs
- io.write("\n")
- if i == 3 then
- if args[2] == "verbos" or args[2] == "both" then
- --io.write(" ".. a.. ": ")
- for s, m in pairs(n) do -- FOR 3 has 6 pairs
- -- name
- -- optional
- -- type
- -- description
- -- nullable
- -- vararg
- io.write(" ".. tostring(s).. ": ".. tostring(m))
- io.write("\n")
- end
- else
- if n["optional"] then
- io.write(" ".. n["type"].. " (".. n["name"].. ")")
- else
- io.write(" ".. n["type"].. " [".. n["name"].. "]")
- end
- end
- else
- io.write(" ".. a.. ": ".. n)
- end
- end
- else
- io.write(" "..l..": ".. b)
- end
- i = i+1
- io.write("\n")
- end
- io.write("\n")
- end
- end
- io.flush()
- io.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement