diff --git a/docs/DataTable_API.md b/docs/DataTable_API.md index ddb1577a2..88ab3070f 100644 --- a/docs/DataTable_API.md +++ b/docs/DataTable_API.md @@ -11,18 +11,36 @@ So if you have a 'FWeaponStruct', you can build a DataTable full of 'FWeaponStru You can create a DataTable (in addition to creating it directly from the content browser) directly from python: ```python +import unreal_engine as ue + +from unreal_engine.classes import DataTableFactory +from unreal_engine.structs import Transform + +dt_factory = DataTableFactory() +dt_factory.Struct = Transform + +dt = dt_factory.factory_create_new('/Game/TransformDataTable') ``` -data_table_add_row(row_name, struct) +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) + +Once you get a reference to a DataTable you can use the api: + +### data_table_add_row(row_name, struct) + +```python +# add an empty Transform +dt.data_table_add_row('FirstRow', Transform()) +``` -data_table_remove_row(row_name) +### data_table_remove_row(row_name) -data_table_rename_row(old_row_name, new_row_name) +### data_table_rename_row(old_row_name, new_row_name) -data_table_as_dict() +### data_table_as_dict() -data_table_as_json(flags=0) +### data_table_as_json(flags=0) -data_table_find_row(row_name) +### data_table_find_row(row_name) -data_table_get_all_rows() +### data_table_get_all_rows()