Add an event handler that handles one event only. This is the most efficient way of handling events, since it means your code will have less branches in the event handling portion of it, resulting in greater overall performance, but it requires the most preparation.
local object = {}
function object:handleEventOne(event, data)
print("this method handles eventOne!")
end
function object:handleEventTwo(event, data)
print("this method handles eventTwo!")
end
events:addFunctionReceiver(object, object.handleEventOne, "eventOne")
events:addFunctionReceiver(object, object.handleEventTwo, "eventTwo")