Factorio.com|Forums|Wiki|Mod Portal|API Docs

# Factorio Runtime Docs Version 2.0.77

# Tags - Runtime Docs

## Tags :: dictionary[string → AnyBasic]

A dictionary of string to the four basic Lua types: `string`, `boolean`, `number`, `table`.

Note that the API returns tags as a simple table, meaning any modifications to it will not propagate back to the game. Thus, to modify a set of tags, the whole table needs to be written back to the respective property.

Tables inside Tags that have numeric keys but are not sequences (e.g. `tags = {foo = {nil, "something"}}` or `tags = {bar = {[4] = "cat"}}`) will have their keys converted to strings when read back from the game (e.g. `{foo = {["2"] = "something"}}` or `{bar = {["4"] = "cat"}}`). Only sequences without gaps will have their keys maintained as numeric.

#### Example

    {a = 1, b = true, c = "three", d = {e = "f"}}

Concept used in

- LuaBootstrap::raise_script_revive()
- LuaEntity::tags
- LuaGuiElement::add()
- LuaGuiElement::tags
- LuaItemCommon::get_blueprint_entity_tags()
- LuaItemCommon::set_blueprint_entity_tags()
- LuaItemCommon::tags
- LuaRecord::get_blueprint_entity_tags()
- LuaRecord::set_blueprint_entity_tags()
- LuaSurface::create_entity()
- LuaUndoRedoStack::get_undo_tags()
- LuaUndoRedoStack::get_redo_tags()
- BlueprintEntity
- ItemStackDefinition
- UndoRedoAction
- on_built_entity
- on_robot_built_entity
- on_space_platform_built_entity
- script_raised_revive