Difference between revisions of "Multishell (API)"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) (Or rather, said program leaves part of itself loaded, as an API of sorts.) |
MKlegoman357 (Talk | contribs) m (Added argument to .getTitle) |
||
Line 14: | Line 14: | ||
{{API table/row | {{API table/row | ||
|[[multishell.getCurrent]]() | |[[multishell.getCurrent]]() | ||
− | |{{type|number}} | + | |{{type|number}} tabID |
|Returns the ID of the currently running tab. | |Returns the ID of the currently running tab. | ||
|odd}} | |odd}} | ||
Line 31: | Line 31: | ||
{{API table/row | {{API table/row | ||
− | |[[multishell.setFocus]]({{type|number}} | + | |[[multishell.setFocus]]({{type|number}} tabID) |
|{{type|boolean}} success | |{{type|boolean}} success | ||
|Switches focus to the specified tab. | |Switches focus to the specified tab. | ||
Line 37: | Line 37: | ||
{{API table/row | {{API table/row | ||
− | |[[multishell.setTitle]]({{type|number}} | + | |[[multishell.setTitle]]({{type|number}} tabID, {{type|string}} title) |
| | | | ||
|Relabels the specified tab to use the specified title. | |Relabels the specified tab to use the specified title. | ||
Line 43: | Line 43: | ||
{{API table/row | {{API table/row | ||
− | |[[multishell.getTitle]]() | + | |[[multishell.getTitle]]({{type|number}} tabID) |
|{{type|string}} title | |{{type|string}} title | ||
|Returns the title of the specified tab. | |Returns the title of the specified tab. | ||
Line 50: | Line 50: | ||
{{API table/row | {{API table/row | ||
|[[multishell.getFocus]]() | |[[multishell.getFocus]]() | ||
− | |{{type|number}} | + | |{{type|number}} tabID |
|Returns the ID of the currently focused tab. | |Returns the ID of the currently focused tab. | ||
|odd}} | |odd}} |
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
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. |