Jump to content




Ctrl-T


  • You cannot reply to this topic
10 replies to this topic

#1 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 16 January 2014 - 11:29 PM

Termination blocking methods please and thankyou!

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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

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.

#3 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 16 January 2014 - 11:47 PM

You've been around long enough to know better, Csstform.

#4 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

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.

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.

#6 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 17 January 2014 - 12:31 AM

View PostBomb Bloke, on 17 January 2014 - 12:20 AM, said:

A pickaxe is an even simpler method of stopping your script.

That just made my day :D

#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 17 January 2014 - 12:53 AM

View PostBomb Bloke, on 17 January 2014 - 12:20 AM, said:

Bear in mind that while Ctrl+T can be blocked
still not a fan of that phrasing, CTRL+T is not being 'blocked', termination is being prevented, but nothing is being blocked. CTRL+T still works and still fires a termination event when you use any function other than os.pullEvent, its just you're choosing to ignore the event, thus preventing termination.

#8 robhol

  • Members
  • 182 posts

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 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.

#10 Symmetryc

  • Members
  • 434 posts

Posted 17 January 2014 - 02:35 PM

View Postrobhol, 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.
No your not, because the event doesn't even stop your script in the first place... a function stops your script which you are choosing to use (os.pullEvent). Btw why use os.pullEventRaw, when it is simply a wrapper for coroutine.yield?

#11 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 17 January 2014 - 10:50 PM

Sorry for not searching, but thanks for te help. :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users