terminate event

From ComputerCraft
Jump to: navigation, search
terminate
Event
Returns

Source CC:Tweaked

Occurs when the user holds down Ctrl-T to terminate the running program. Note that this event is intercepted by os.pullEvent, which handles it by forcefully terminating the program. To handle it, use os.pullEventRaw (or coroutine.yield) instead.

ExampleExampleWait for termination
Prints Nope! every time an event is fired that is not termination, at which point Goodbye is printed
Code
while true do
  local event = os.pullEventRaw()
  if event == 'terminate' then
    print("Goodbye")
    return
  else
    print("Nope!")
  end
end