editable LuaRecord.contents and library tables - multi-server blueprint sync (Clusterio)
Posted: Tue Oct 06, 2026 1:32 pm
What
A way for a mod to add a new record to the Game blueprints library from an export string (or from a blueprint item), and to remove one. Today a script can read and edit records that already exist, but it can't create or delete one.
Why
I am developing for Clusterio Gridworld(https://www.youtube.com/watch?v=BnOsXpc4CbU) and will be running a multi-server cluster where every server is a separate save. I'd like each server's Game blueprints shelf to share the cluster's blueprints. Reading, exporting and updating are possible. Adding a blueprint that another server's shelf has, or removing one, isn't.
What we use today (tested on 2.1.21)
Suggested API (names are only suggestions)
Nice to have:
A way for a mod to add a new record to the Game blueprints library from an export string (or from a blueprint item), and to remove one. Today a script can read and edit records that already exist, but it can't create or delete one.
Why
I am developing for Clusterio Gridworld(https://www.youtube.com/watch?v=BnOsXpc4CbU) and will be running a multi-server cluster where every server is a separate save. I'd like each server's Game blueprints shelf to share the cluster's blueprints. Reading, exporting and updating are possible. Adding a blueprint that another server's shelf has, or removing one, isn't.
What we use today (tested on 2.1.21)
- game.blueprints + LuaRecord::export_record(): read and export every entry.
- Editing an existing record: LuaRecord::set_blueprint_entities, set_blueprint_tiles, label, blueprint_description, preview_icons, checked with valid_for_write. This works: a placeholder record was overwritten from a string imported into a script inventory.
- LuaItemStack::import_stack / export_stack and LuaItemCommon::set_blueprint_entities: items only, not library records.
Suggested API (names are only suggestions)
Code: Select all
LuaGameScript::import_blueprint_record(string, index?) -> LuaRecord? -- adds to the Game blueprints shelf; nil or an error code on a bad string
LuaGameScript::create_blueprint_record{ type = "blueprint" | "blueprint-book" | "deconstruction-planner" | "upgrade-planner", index? } -> LuaRecord
LuaRecord::destroy() -- removes a Game blueprints record (valid_for_write records only)- the same for a book's contents (LuaRecord::insert_record / import_record into a book record);
- an event when a Game blueprints record is added, removed or edited, so mods don't have to poll game.blueprints.