custom-building-function
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
custom-building-function [2022/03/30 11:02] – [Step 1: Defining an BUILDING_FUNCTION Class using a Lua Table] minotorious | custom-building-function [2022/04/30 19:23] (current) – minotorious | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | [[api/ | + | [[api/ |
For reference all available [[api/ | For reference all available [[api/ | ||
- | ===== Creating & Using a Custom | + | ===== Creating & Using a Custom |
- | ==== Step 1: Defining | + | ==== Step 1: Defining |
To create a custom [[api/ | To create a custom [[api/ | ||
Line 20: | Line 20: | ||
</ | </ | ||
Now that the base [[api/ | Now that the base [[api/ | ||
+ | |||
+ | All [[api/ | ||
+ | |||
+ | '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | '' | ||
+ | |||
+ | For example below we set up a function that upon activation logs its properties and upon reload executes a back-call to its activation function. | ||
<code lua> | <code lua> | ||
+ | function MY_BUILDING_FUNCTION: | ||
+ | mod: | ||
+ | mod: | ||
+ | mod: | ||
+ | | ||
+ | return true | ||
+ | end | ||
+ | function MY_BUILDING_FUNCTION: | ||
+ | self: | ||
+ | end | ||
</ | </ | ||
- | And finally we register | + | And finally we register |
<code lua> | <code lua> | ||
mod: | mod: | ||
Line 47: | Line 67: | ||
In case you omit any properties you don't yet need to explicitly set they will use their default values. As we have done with '' | In case you omit any properties you don't yet need to explicitly set they will use their default values. As we have done with '' | ||
- | ==== Step 3: Using an Instance of an BUILDING_FUNCTION Class ==== | + | ==== Step 3: Using an Instance of a BUILDING_FUNCTION Class ==== |
When you want to use your new [[api/ | When you want to use your new [[api/ | ||
<code lua> | <code lua> |
custom-building-function.1648652527.txt.gz · Last modified: 2022/03/30 11:02 by minotorious