Ctrl-T
Started by Csstform, Jan 16 2014 11:29 PM
10 replies to this topic
#1
Posted 16 January 2014 - 11:29 PM
Termination blocking methods please and thankyou!
#2
Posted 16 January 2014 - 11:35 PM
how very demanding, didn't bother searching or doing any of your own research?!
nothing 'blocks' termination...
everything that allows termination uses os.pullEvent, os.pullEvent's implementation is as follows
as you can see it checks for the terminate event and ends the program when detected... as such to stop termination you must use either os.pullEventRaw or coroutine.yield.
nothing 'blocks' termination...
everything that allows termination uses os.pullEvent, os.pullEvent's implementation is as follows
function os.pullEvent( _sFilter )
local eventData = { os.pullEventRaw( _sFilter ) }
if eventData[1] == "terminate" then
error( "Terminated", 0 )
end
return unpack( eventData )
end
as you can see it checks for the terminate event and ends the program when detected... as such to stop termination you must use either os.pullEventRaw or coroutine.yield.
#4
Posted 16 January 2014 - 11:49 PM
Yes, basically as theoriginalbit said, you want to replace all your 'os.pullEvent' occurrences with 'os.pullEventRaw'. If you do this, however, make sure it doesn't have infinite loops etc.
Also, always search before asking. A quick search uncovered numerous similar questions.
Also, always search before asking. A quick search uncovered numerous similar questions.
#5
Posted 17 January 2014 - 12:20 AM
Bear in mind that while Ctrl+T can be blocked, there's no way to prevent someone from doing what they like with your system should their character get physical access to it. A disk drive, a disk with an empty startup script, and Ctrl+R is all that's needed to get a command line. A pickaxe is an even simpler method of stopping your script.
#7
Posted 17 January 2014 - 12:53 AM
Bomb Bloke, on 17 January 2014 - 12:20 AM, said:
Bear in mind that while Ctrl+T can be blocked
#8
Posted 17 January 2014 - 04:20 AM
You're blocking the event from stopping your script. I'm not sure why you're splitting hairs, it's not even an important distinction.
#9
Posted 17 January 2014 - 07:04 AM
I don't quite like his phrasing either (you can indeed block that particular use of Ctrl-T, in that users can no longer terminate scripts with it), but I believe I see his point: Information given should be accurate. The combo itself cannot be disabled, and the event still fires when it's pressed. Altering the way it's handled in order to prevent a certain outcome doesn't change that.
Most simply ignore the thrown event, but it's still there and can be used for other purposes. Making a script exit "cleanly" would be a good example.
Most simply ignore the thrown event, but it's still there and can be used for other purposes. Making a script exit "cleanly" would be a good example.
#10
Posted 17 January 2014 - 02:35 PM
robhol, on 17 January 2014 - 04:20 AM, said:
You're blocking the event from stopping your script. I'm not sure why you're splitting hairs, it's not even an important distinction.
#11
Posted 17 January 2014 - 10:50 PM
Sorry for not searching, but thanks for te help.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











