custom-data
Differences
This shows you the differences between two versions of the page.
custom-data [2022/03/29 20:45] – created minotorious | custom-data [2022/03/29 20:58] (current) – minotorious | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | DATA classes are the most basic type in Foundation that all other types are based on. | + | [[api# |
- | For reference all available pure DATA classes can be found in [[api# | + | For reference all available pure [[api# |
===== Creating & Using a Custom DATA Object ===== | ===== Creating & Using a Custom DATA Object ===== | ||
==== Step 1: Defining a DATA Object using a Lua Table ==== | ==== Step 1: Defining a DATA Object using a Lua Table ==== | ||
- | To create a custom DATA object we will need to make use of the '' | + | To create a custom |
- | Here you decide what properties your custom DATA object will contain. | + | Here you decide what properties your custom |
<code lua> | <code lua> | ||
local MY_DATA_OBJECT = { | local MY_DATA_OBJECT = { | ||
Line 22: | Line 22: | ||
Make sure not to forget the '' | Make sure not to forget the '' | ||
- | Also remember that you can define properties based on the basic [[data-types|data types]] (i.e. string, integer, float, etc.) or based on any of the existing DATA or ASSET objects, as well as '' | + | Also remember that you can define properties based on the basic [[data-types|data types]] (i.e. string, integer, float, etc.) or based on any of the existing |
==== Step 2: Using a DATA Object ==== | ==== Step 2: Using a DATA Object ==== | ||
- | Note: This also aplies to using vanilla DATA Objects! | + | Note: This also aplies to using vanilla |
- | During gameplay when you will need to instantiate a DATA object you will have to use the '' | + | During gameplay when you will need to instantiate a [[api# |
<code lua> | <code lua> | ||
local myData = foundation.createData( | local myData = foundation.createData( | ||
Line 39: | Line 39: | ||
In case you omit any properties you don't yet need to explicitly set they will use their default values until otherwise specified. 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 until otherwise specified. As we have done with'' | ||
- | If you want to alter a property after the DATA object has been instantiated you can of course do so at will like this. | + | If you want to alter a property after the [[api# |
<code lua> | <code lua> | ||
myData.Property1 = " | myData.Property1 = " | ||
</ | </ |
custom-data.1648601113.txt.gz · Last modified: 2022/03/29 20:45 by minotorious