Component

Component

class

Typed data every block of a type keeps from its placement, listed by StaticBlock.components; saved by field name and part of the sim state

  • load-only Usable only while mods load. The game seals these members once loading finishes, so a call or a write from a running world raises an error.

Fields

NameTypeDescription
fields load-only table<string, string> Field name to its type: "integer", "boolean", "item" or "string". Fields go in name order; --!sim sees integer, boolean and item fields as columns, an item as its sim_id
version load-only integer Version of the fields, 1 by default; a save written by a lower version goes through migrate
migrate load-only function? migrate(fields, version) gets the fields a save holds, by name with items as their names, and the version that wrote them; it returns the fields for the current version
Standard members (5)

These members are available on all classes of this kind.

Component.cast(object) Trying to cast Object into Component
Component.get_class() Return Component class object
Component.find(name) Looks Component up in db, nil when there is none
Component.get(name) Takes Component from db, reports a miss to the log
Component.reg(name, spec) load-only Register a new Component static object, or take the registered one of that name
Inherited from Prototype (2)
Inherited from Object (1)