Please, use https://mods.factorio.com/mod/zk-lib instead. This mod combines events of other scripts and adding new manipulations with events (such like canceling an event). Designed for mod developers. There is an example in the mod. Don't forget about dependencies.
Lua libraries for use by other mods and submods that are parts of a larger mod.