Multiple windows
Each mounted GUI needs a unique root_name. Hooks, click handlers, and saved
locations are namespaced per root.
const INVENTORY: &str = "my_mod_inventory";const SETTINGS: &str = "my_mod_settings";
factorio_rs_gui::shared::runtime::mount(screen, INVENTORY, lua_fn0(inventory_app));factorio_rs_gui::shared::runtime::mount(screen, SETTINGS, lua_fn0(settings_app));- Use a mod-unique prefix (
my_mod_...) so other mods’ screen children do not collide. - Call
installfor each root you care about after reload (e.g. fromOnTick). unmount(root_name)removes one window; others stay mounted.- Hook order is per root, each
apphas its ownstate!sequence.
Why not share one root?
Section titled “Why not share one root?”state! and click registration key off the current root. Mixing unrelated UIs
in one tree forces a full rebuild of everything when any hook changes. Separate
roots keep rebuilds and storage isolated.