LuaBootstrap

class LuaBootstrap
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.

on_init(f)

Register a callback to be run on module init.

Parameters
f :: function(): The function to call. Passing nil will unregister the handler.
on_load(f)

Register a function to be run on module load.

Parameters
f :: function(): The function to call. Passing nil will unregister the handler.
on_configuration_changed(f)

Register a function to be run when the mod configuration changes.

Parameters
f :: function(): The handler for this event. Passing nil will unregister the handler.
on_event(event, f)

Register a handler to run on event or events.

Parameters
event :: defines.events or array of defines.events: The events to invoke the handler on
f :: function(Event): The handler to run. Passing nil will unregister the handler. The handler will receive a table that contains the key 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_event_name() → uint

Generate a new, unique event ID.

Return value
The new ID