Help API

Functionhelp.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(
  • prefix : string
)
Returns table
Part of CC:Tweaked
API Help
ExampleComplete "hello" topic
Should print "hello".
Code
<nowiki>print("hell"..help.completeTopic("hell")[1])</nowiki>
Output hello
Functionhelp.lookup
Returns the location of the help file for the given topic.
Syntax help.lookup(
  • topic : string
)
Returns string
Part of CC:Tweaked
API Help
ExamplePrint location of hello help file
Code
<nowiki>print(help.lookup("hello"))</nowiki>
Functionhelp.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
ExamplePrint help path
Prints "/rom/help", unless help.setPath has been used.
Code
<nowiki>print(help.path())</nowiki>
Output /rom/help
Functionhelp.setPath
Sets the colon-seperated list of directories where help files are searched for to newPath
Syntax help.setPath(
  • newPath : string
)
Returns nil
Part of CC:Tweaked
API Help
ExampleSet help path to `/rom/help`
Prints "/:/rom/help".
Code
<nowiki>
help.setPath("/:/rom/help")
print(help.path())
</nowiki>
Output /:/rom/help
Functionhelp.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
ExampleDisplay all topics
Prints all of the installed topics.
Code
<nowiki>
for _,topic in pairs(help.topics()) do
    print(topic)
end
</nowiki>
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.