This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MikeCraftian's profile picture

Possibility of firing a command before terminating?

Started by MikeCraftian, 29 April 2014 - 10:52 AM
MikeCraftian #1
Posted 29 April 2014 - 12:52 PM
Im messing around with Rednet and im wondering if I could make a computer send out a message when it gets Terminated (Holding Ctrl + T for 3 secs) I can't realy find a way
MKlegoman357 #2
Posted 29 April 2014 - 01:10 PM
You can use os.pullEventRaw to catch 'terminate' events.


while true do
  local event = os.pullEventRaw()

  if event == "terminate" then
    print("Terminating...")
  end
end

EDIT: added a while loop.
Edited on 29 April 2014 - 11:12 AM