Difference between revisions of "Terminate (event)"
From ComputerCraft Wiki
(Created event page) |
(Less confusing example for newbies. Also removed the comment that was implying to override os.pullEvent if you wish to capture this event) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
{{Event | {{Event | ||
|name=terminate | |name=terminate | ||
− | |desc=Fired when CTRL+T is held | + | |desc=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 |
+ | }} | ||
+ | {{Example | ||
+ | |desc=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 | ||
}} | }} |
Latest revision as of 09:48, 28 October 2013
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 |