on_init(f) | Register a callback to be run on module init. |
on_load(f) | Register a function to be run on module load. |
on_configuration_changed(f) | Register a function to be run when the mod configuration changes. |
on_event(event, f) | Register a handler to run on event or events. |
generate_event_name() → uint | Generate a new, unique event ID. |
Entry point for registering event handlers. It is accessible through the global object named script
.
Register a callback to be run on module init.
Register a function to be run on module load.
nil
will unregister the handler.Register a function to be run when the mod configuration changes.
nil
will unregister the handler.Register a handler to run on event or events.
name
(of type defines.events) specifying the name
of the event it was called to handle, and tick
that specifies when the event was created. This table will
also contain other fields, depending on the type of the event. See
the list of Factorio events for a listing of these additional fields.Generate a new, unique event ID.