multishell.getFocus

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function multishell.getFocus
Returns the ID of the currently focused tab. This is the Tab that is currently being shown to the user.
Syntax multishell.getFocus()
Returns number focused tab ID
Part of ComputerCraft
API multishell

Examples

Grid paper.png  Example
Checks to see if currently running program is focused or not.
Code
local focusedTabID = multishell.getFocus()
local currentTabID = multishell.getCurrent()

if currentTabID ~= focusedTabID then -- If the current tab is not focused
  print("I'm running in the background and the user cannot see me!")
else
  print("I'm running on the top of other programs and the user currently sees me!")
end