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

Can still terminate after os.pullEventRaw....

Started by xxslasherrmx, 29 December 2014 - 10:09 PM
xxslasherrmx #1
Posted 29 December 2014 - 11:09 PM
So I am a noobie at lua still but I have used this line of code in another program before.

local oldpullEvent = os.pullEvent
os.pullEvent = os.pullEventRaw

--code--

os.pullEvent = oldpullEvent

However, using it in my program, it doesn't seem to work. I think it's because I am loading up a button API in it. Can you take a look and see what I can do to prevent Ctrl + T?

http://pastebin.com/bWC33jg8
valithor #2
Posted 30 December 2014 - 01:35 AM
-snip

It might be worth going through and seeing if any of the apis you used uses coroutine.yield. os.pullEvent is basically just coroutine.yield, so if any of them use coroutine.yield then you can set coroutine.yield to os.pullEventRaw instead of setting os.pullEvent to it.

edit: note I did not actually read through the code. This may or may not be the problem.
Edited on 30 December 2014 - 12:35 AM
Lignum #3
Posted 30 December 2014 - 02:04 AM
-snip

It might be worth going through and seeing if any of the apis you used uses coroutine.yield. os.pullEvent is basically just coroutine.yield, so if any of them use coroutine.yield then you can set coroutine.yield to os.pullEventRaw instead of setting os.pullEvent to it.

edit: note I did not actually read through the code. This may or may not be the problem.

coroutine.yield is the same as os.pullEventRaw not os.pullEvent. So this wouldn't be the problem.

Usually using this method should disable all termination. Unless you provide your entire code we can't really help you much. Oh dear, I completely didn't see that pastebin link, sorry.
Edited on 30 December 2014 - 01:12 AM
KingofGamesYami #4
Posted 30 December 2014 - 03:12 AM
Although I cannot see the apis or programs you reference, control + T should not work on your script.

However, your script can terminate itself, for example line 164 calls error(), which simply terminates the script silently.