multishell (API)

From ComputerCraft Wiki
Jump to: navigation, search

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 ...").


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.