custom-classes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
custom-classes [2020/07/08 10:57] – [Custom components] maxime | custom-classes [2022/03/29 20:36] (current) – added creacting custom classes guides minotorious | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Custom | + | ====== Custom |
You can define new types with the '' | You can define new types with the '' | ||
Line 9: | Line 9: | ||
---- | ---- | ||
- | ===== Extendable | + | ===== Extendable |
- | Some core types are flagged as **Extendable** in the documentation. This means an extendable type can be used as parent type when creating a custom type. In addition to new functions, you can override some base functions existing in the parent type, flagged as **virtual**. | + | Some core types are flagged as **Extendable** in the documentation. This means an extendable type can be used as parent type when creating a custom type. In addition to new functions, you can override some base functions existing in the parent type, flagged as **Virtual function**. When extend a virtual function, define a new function for your custom type with the same type and parameters. You can call the parent function using the keyword '' |
+ | |||
+ | <code lua> | ||
+ | function myCustomTypeInfo: | ||
+ | self.super: | ||
+ | ... -- custom additional behavior | ||
+ | end | ||
+ | </ | ||
---- | ---- | ||
- | ===== Custom | + | ===== Custom |
For custom types extending '' | For custom types extending '' | ||
Line 27: | Line 34: | ||
| | ||
You can see an example of component definition in the mod Example 02 in '' | You can see an example of component definition in the mod Example 02 in '' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Guides on Custom Classes ===== | ||
+ | |||
+ | * [[custom-data|Creating a Custom DATA Object]] | ||
+ | * [[custom-asset|Creating a Custom ASSET Object]] | ||
+ | * [[custom-building-function|Creating a Custom BUILDING_FUNCTION]] | ||
+ | * [[custom-mandate|Creating a Custom MANDATE]] |
custom-classes.txt · Last modified: 2022/03/29 20:36 by minotorious