Closed kumpuu closed 6 years ago
That method uses the Events module to register the handlers in the Changes module to handle the relevant factorio events.
I couldn't find any caller outside spec/ which I was told is for testing purposes only. Hence the question.
You can call it yourself, or not, at your discretion. You can also manually do either half of what it does, separately.
The thing I want to know is why this func is there, it's only called in testing code. At first sight it looked like part of some standard module interface to put event registering in. But apparently not, well I guess it's not relevant for me.
It is there for you to call, just like every other function in this library that's "only called in testing code".
register_events() is a helper function to register events for certain actions. Initially these modules automatically registered events, but what if someone wasn't using the Event system, or only wanted to use the functions from the module. So the decision was made that if events needed to be registered, modders would have to explicitly register them (either via the help function) or manually via Event or script.on_event()
https://github.com/Afforess/Factorio-Stdlib/blob/32bfcf6565fd4b1e6fc96560edd76c17680bfc10/stdlib/event/changes.lua#L77
What does this function do (generally)? @Afforess @Nexela