Event.Gui module

Makes monolithic Factorio GUI events more manageable.

Usage

local Gui = require('__stdlib__/stdlib/event/gui')

Functions

on_click(gui_element_pattern, handler) Registers a function for a given gui element name or pattern when the element is clicked.
on_checked_state_changed(gui_element_pattern, handler) Registers a function for a given GUI element name or pattern when the element checked state changes.
on_text_changed(gui_element_pattern, handler) Registers a function for a given GUI element name or pattern when the element text changes.
on_elem_changed(gui_element_pattern, handler) Registers a function for a given GUI element name or pattern when the element selection changes.
on_selection_state_changed(gui_element_pattern, handler) Registers a function for a given GUI element name or pattern when the element state changes (drop down).
on_value_changed(gui_element_pattern, handler) Registers a function for a given GUI element name or pattern when the element value changes (slider).
on_confirmed(gui_element_pattern, handler) Registers a function for a given GUI element name or pattern when the element is confirmed.

Functions

# on_click(gui_element_pattern, handler)

Registers a function for a given gui element name or pattern when the element is clicked.

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the gui element
  • handler : (function) the function to call when gui element is clicked
Returns:
# on_checked_state_changed(gui_element_pattern, handler)

Registers a function for a given GUI element name or pattern when the element checked state changes.

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the GUI element
  • handler : (function) the function to call when GUI element checked state changes
Returns:
# on_text_changed(gui_element_pattern, handler)

Registers a function for a given GUI element name or pattern when the element text changes.

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the GUI element
  • handler : (function) the function to call when GUI element text changes
Returns:
# on_elem_changed(gui_element_pattern, handler)

Registers a function for a given GUI element name or pattern when the element selection changes.

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the GUI element
  • handler : (function) the function to call when GUI element selection changes
Returns:
# on_selection_state_changed(gui_element_pattern, handler)

Registers a function for a given GUI element name or pattern when the element state changes (drop down).

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the GUI element
  • handler : (function) the function to call when GUI element state changes
Returns:
# on_value_changed(gui_element_pattern, handler)

Registers a function for a given GUI element name or pattern when the element value changes (slider).

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the GUI element
  • handler : (function) the function to call when GUI element state changes
Returns:
# on_confirmed(gui_element_pattern, handler)

Registers a function for a given GUI element name or pattern when the element is confirmed.

Parameters:
  • gui_element_pattern : (string) the name or string regular expression to match the GUI element
  • handler : (function) the function to call when GUI element state changes
Returns: