Posted 30 August 2015 - 09:53 AM
Lets say I have the following code:
the example function will print "HIT" no matter what event the manager catches, even though the function has called os.pullEvent with a filter of "key". What changes do I need to make the manager to prevent this from happening? I have a feeling that if I knew what the filter was I could manually check if the event is the same and if it is then resume it, but I don't know how to find out what filter they set in pullEvent/pullEventRaw/coroutine.yield.
function example()
os.pullEvent("key")
print("HIT")
end
local co = coroutine.create( example )
function manager()
while true do
local e = os.pullEvent()
coroutine.resume( co, e )
end
end
manager()
the example function will print "HIT" no matter what event the manager catches, even though the function has called os.pullEvent with a filter of "key". What changes do I need to make the manager to prevent this from happening? I have a feeling that if I knew what the filter was I could manually check if the event is the same and if it is then resume it, but I don't know how to find out what filter they set in pullEvent/pullEventRaw/coroutine.yield.