Posted 23 November 2013 - 09:19 AM
Hello,
im currently writing a touchscreen api and have to pull for the "monitor_touch" event. I dont want the user to redirect all of these events to my api, because it will complicate the event handling. This is why i came up with a simple hook:
That works fine … until the program ends … In this case the hook will stay active until i restart the computer.
Is there any better way to monitor events without actively pulling for them (coroutines dont work)? Or is there a way to detect the end of my program (terminate event is not sufficient, because it is not fired on a normal program termination)?
Best regards
Zacherl
im currently writing a touchscreen api and have to pull for the "monitor_touch" event. I dont want the user to redirect all of these events to my api, because it will complicate the event handling. This is why i came up with a simple hook:
local O_pullEventRaw = os.pullEventRaw
function C_pullEventRaw()
event, a1, a2, a3, a4, a5 = O_pullEventRaw()
print("hooked: " .. event)
return event, a1, a2, a3, a4, a5
end
os.pullEvent = C_pullEventRaw
while true do
event = os.pullEvent("mouse_click")
print("normal mouse click event")
end
That works fine … until the program ends … In this case the hook will stay active until i restart the computer.
Is there any better way to monitor events without actively pulling for them (coroutines dont work)? Or is there a way to detect the end of my program (terminate event is not sufficient, because it is not fired on a normal program termination)?
Best regards
Zacherl