Edited by Selim, 11 March 2015 - 11:27 PM.
Secure sleep() and read() [Un-Solved]
Started by Selim, Mar 11 2015 11:25 PM
4 replies to this topic
#1
Posted 11 March 2015 - 11:25 PM
So, I am making a program that I do not want ayone using being able to access the files. So, when I need to use os.pullEvent(), I use os.pullRawEvent() to stop someone from being able to Ctrl + T out of the program and wreak havoc. If I use sleep() or read(), as far as I know, they both use os.pullEvent(). How would I go about remaking sleep() and read() so that the programs that they are in cannot be terminated. Thanks!
#2
Posted 11 March 2015 - 11:29 PM
If you have
If you want to save the old pullEvent (which you should) do
os.pullEvent = os.pullEventRawnear the start of your code, it will change os.pullEvent to os.pullEventRaw for all programs (until you change it back or restart the computer)
If you want to save the old pullEvent (which you should) do
local oldPull = os.pullEvent os.pullEvent = os.pullEventRawThat way you can do
os.pullEvent = oldPullto change it back.
#3
Posted 11 March 2015 - 11:30 PM
I believe you are not quite understanding how pullEvent and pullEventRaw work. if you call os.pullEventRaw or not when events are passed they will still go to os.pullEvent to counter this we can actually redefine the function. pullEvent and pullEventRaw are exactly the same functions with the same handling except pullEvent handles terminate events specially.
As simply put as possible this will completely override os.pullEvent and terminate
EDIT: ninja'd
As simply put as possible this will completely override os.pullEvent and terminate
os.pullEvent = os.pullEventRaw
EDIT: ninja'd
Edited by HDeffo, 11 March 2015 - 11:31 PM.
#4
Posted 11 March 2015 - 11:30 PM
Quintuple Agent, on 11 March 2015 - 11:29 PM, said:
If you have
If you want to save the old pullEvent (which you should) do
os.pullEvent = os.pullEventRawnear the start of your code, it will change os.pullEvent to os.pullEventRaw for all programs (until you change it back or restart the computer)
If you want to save the old pullEvent (which you should) do
local oldPull = os.pullEvent os.pullEvent = os.pullEventRawThat way you can do
os.pullEvent = oldPullto change it back.
Edited by Selim, 11 March 2015 - 11:31 PM.
#5
Posted 11 March 2015 - 11:30 PM
if you override the os.pullEvent function with os.pullEventRaw everything works as you are intending:
os.pullEvent = os.pullEventRawThats it
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











