Component
classTyped 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
| Name | Type | Description | |
|---|---|---|---|
| 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)
- name read-only Object name
- Prototype:is_valid() Returns false once the underlying engine object has been destroyed
Inherited from Object (1)
- Object:get_class() Class of this object