Skip to content

Commit cdc4d75

Browse files
author
Roberto De Ioris
committed
2 parents 098f306 + cdb8555 commit cdc4d75

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

docs/DataTable_API.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,36 @@ So if you have a 'FWeaponStruct', you can build a DataTable full of 'FWeaponStru
1111
You can create a DataTable (in addition to creating it directly from the content browser) directly from python:
1212

1313
```python
14+
import unreal_engine as ue
15+
16+
from unreal_engine.classes import DataTableFactory
17+
from unreal_engine.structs import Transform
18+
19+
dt_factory = DataTableFactory()
20+
dt_factory.Struct = Transform
21+
22+
dt = dt_factory.factory_create_new('/Game/TransformDataTable')
1423
```
1524

16-
data_table_add_row(row_name, struct)
25+
Being a UStruct, Transform is a perfectly valid type for a DataTable (you can obviously use any structure, check https://github.com/20tab/UnrealEnginePython/blob/master/examples/create_user_defined_struct.py for creating custom structs)
26+
27+
Once you get a reference to a DataTable you can use the api:
28+
29+
### data_table_add_row(row_name, struct)
30+
31+
```python
32+
# add an empty Transform
33+
dt.data_table_add_row('FirstRow', Transform())
34+
```
1735

18-
data_table_remove_row(row_name)
36+
### data_table_remove_row(row_name)
1937

20-
data_table_rename_row(old_row_name, new_row_name)
38+
### data_table_rename_row(old_row_name, new_row_name)
2139

22-
data_table_as_dict()
40+
### data_table_as_dict()
2341

24-
data_table_as_json(flags=0)
42+
### data_table_as_json(flags=0)
2543

26-
data_table_find_row(row_name)
44+
### data_table_find_row(row_name)
2745

28-
data_table_get_all_rows()
46+
### data_table_get_all_rows()

0 commit comments

Comments
 (0)