terminate event

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.

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

Source CC:Tweaked
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.