Terminate (event)

From ComputerCraft Wiki
Jump to: navigation, search



Grid Modem.png  Event terminate
Fired when CTRL+T is held for at least 1 second. NOTE: This event cannot be captured with an unmodified os.pullEvent, os.pullEventRaw or coroutine.yield should be used whenever possible instead of overriding os.pullEvent
Returned Object 1 Nothing


Grid paper.png  Example
This loop listens for the terminate event and exits the program when found, cleaning the screen first
Code
while true do
  local event = os.pullEventRaw()
  if event == "terminate" then
    term.clear()
    term.setCursorPos(1,1)
    return
  else
    print("Still running!")
  end
end