So I am using os.pullEvent() for touch screen, but I also have to prevent people from terminating my program. If I use os.pullEvent = os.pullEventRaw then the touch screen does not work. So can I just have it so it completely ignores the terminate command?
Is there a blacklist for os.pullEvent()
Started by gril002, Apr 07 2016 05:00 PM
3 replies to this topic
#1
Posted 07 April 2016 - 05:00 PM
#2
Posted 07 April 2016 - 06:42 PM
os.pullEventRaw will always return terminate events, no matter what filter you set. When you say your "touch screen does not work", I assume you mean "your script crashes when hitting terminate", in which case your fix is to have your code check that your received event data represents a monitor_touch event was received before trying to treat it like a monitor_touch event.
Post your code if you're still stuck.
Post your code if you're still stuck.
#3
Posted 07 April 2016 - 07:16 PM
You could modify os.pullEvent to ignore "terminate" events.
local unpack = unpack or table.unpack --#compatibility with 5.1 & 5.2
os.pullEvent = function( sFilter ) --#override os.pullEvent
local result
repeat --#pull a raw event until the returned event is not terminate
result = {os.pullEventRaw( sFilter )}
until result[ 1 ] ~= "terminate"
return unpack( result )
end
#4
Posted 07 April 2016 - 07:27 PM
ok tnx helped a lot
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











