Difference between revisions of "Multishell (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(moved Multishell (API) to Multishell: This is actually a program, not an API.)
 
m (Added argument to .getTitle)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
#REDIRECT [[Multishell]]
+
{{lowercase}}
 +
Added by ComputerCraft 1.6, the '''Multishell API''' is used to manipulate tabs.
 +
 
 +
On boot, advanced systems will automatically launch the [[multishell|multishell script]], which by default loads only a single tab running a standard shell ([[CraftOS]] or [[TurtleOS]]). Said script also loads a number of functions into memory to be used as an API by other scripts and/or functions, allowing them to add, switch between, or rename tabs.
 +
 
 +
Note that two related, higher-level commands are also available via the [[shell (API)|shell API]] - [[shell.openTab|shell.openTab()]] and [[shell.switchTab|shell.switchTab()]].
 +
 
 +
Although this API isn't visible to the "apis" shell command, its existence (or lack thereof) provides an easy method to determine if a system has access to the multishell system (eg "if multishell then ...").
 +
 
 +
==API==
 +
 
 +
{{API table|multishell|image=Grid disk.png|2=
 +
 
 +
{{API table/row
 +
|[[multishell.getCurrent]]()
 +
|{{type|number}} tabID
 +
|Returns the ID of the currently running tab.
 +
|odd}}
 +
 
 +
{{API table/row
 +
|[[multishell.getCount]]()
 +
|{{type|number}} tabCount
 +
|Returns the number of tabs currently being handled by the multishell system.
 +
}}
 +
 
 +
{{API table/row
 +
|[[multishell.launch]]({{type|table}} environment, {{type|string}} program path [, {{type|string}} arguments])
 +
|{{type|number}} newTabID
 +
|Launches the specified script in a new tab.
 +
|odd}}
 +
 
 +
{{API table/row
 +
|[[multishell.setFocus]]({{type|number}} tabID)
 +
|{{type|boolean}} success
 +
|Switches focus to the specified tab.
 +
}}
 +
 
 +
{{API table/row
 +
|[[multishell.setTitle]]({{type|number}} tabID, {{type|string}} title)
 +
|
 +
|Relabels the specified tab to use the specified title.
 +
|odd}}
 +
 
 +
{{API table/row
 +
|[[multishell.getTitle]]({{type|number}} tabID)
 +
|{{type|string}} title
 +
|Returns the title of the specified tab.
 +
}}
 +
 
 +
{{API table/row
 +
|[[multishell.getFocus]]()
 +
|{{type|number}} tabID
 +
|Returns the ID of the currently focused tab.
 +
|odd}}
 +
}}
 +
 
 +
[[Category:APIs]]

Latest revision as of 13:39, 10 April 2014

Added by ComputerCraft 1.6, the Multishell API is used to manipulate tabs.

On boot, advanced systems will automatically launch the multishell script, which by default loads only a single tab running a standard shell (CraftOS or TurtleOS). Said script also loads a number of functions into memory to be used as an API by other scripts and/or functions, allowing them to add, switch between, or rename tabs.

Note that two related, higher-level commands are also available via the shell API - shell.openTab() and shell.switchTab().

Although this API isn't visible to the "apis" shell command, its existence (or lack thereof) provides an easy method to determine if a system has access to the multishell system (eg "if multishell then ...").

API

Grid disk.png  multishell (API)
Function Return values Description
multishell.getCurrent() number tabID Returns the ID of the currently running tab.
multishell.getCount() number tabCount Returns the number of tabs currently being handled by the multishell system.
multishell.launch(table environment, string program path [, string arguments]) number newTabID Launches the specified script in a new tab.
multishell.setFocus(number tabID) boolean success Switches focus to the specified tab.
multishell.setTitle(number tabID, string title) Relabels the specified tab to use the specified title.
multishell.getTitle(number tabID) string title Returns the title of the specified tab.
multishell.getFocus() number tabID Returns the ID of the currently focused tab.