Help API

From ComputerCraft
Jump to: navigation, search
FunctionFunctionhelp.completeTopic
Returns a list of topic endings that match the prefix. Can be used with read to allow input of a help topic.
Syntax help.completeTopic()
Returns table
Part of CC:Tweaked
API Help
ExampleExampleComplete "hello" topic
Should print "hello".
Code
print("hell"..help.completeTopic("hell")[1])
Output hello
FunctionFunctionhelp.lookup
Returns the location of the help file for the given topic.
Syntax help.lookup()
Returns string
Part of CC:Tweaked
API Help
ExampleExamplePrint location of hello help file
Code
print(help.lookup("hello"))
FunctionFunctionhelp.path
Returns a colon-separated list of directories where help files are searched for. All directories are absolute.
Syntax help.path()
Returns string
Part of CC:Tweaked
API Help
ExampleExamplePrint help path
Prints "/rom/help", unless help.setPath has been used.
Code
print(help.path())
Output /rom/help
FunctionFunctionhelp.setPath
Sets the colon-seperated list of directories where help files are searched for to newPath
Syntax help.setPath()
Returns nil
Part of CC:Tweaked
API Help
ExampleExampleSet help path to `/rom/help`
Prints "/:/rom/help".
Code
help.setPath("/:/rom/help")
print(help.path())
Output /:/rom/help
FunctionFunctionhelp.topics
Returns a list of topics that can be looked up and/or displayed.
Syntax help.topics()
Returns table
Part of CC:Tweaked
API Help
ExampleExampleDisplay all topics
Prints all of the installed topics.
Code
for _,topic in pairs(help.topics()) do
    print(topic)
end