How can I enter data into a Data Table that is based on a struct, which has another struct data type for a variable?

Hi everybody,

I’m working on a weapon system for a game I’m working on and have run into a bit of a roadblock. What I’m attempting to do is use a data table to house my items for quick data management using CSV files. I have a Stats struct that I’m using to house a number of the combat related pieces of information on the weapons. In the table, this struct ends up being a struct reference variable and when looking in the table, it is displaying each of the variables of that sub struct as one single clump.

I want to be able to create a CSV and drop each value in. Does this mean I’ll have to group a bunch of them together or is there a method that doesn’t suck to work with that I can use to enter the data cleanly and have it imported?

What I have so far is these 2 Structs:

And I’ve created these 2 Data Tables. The problem comes with the “Stats” variable in the Main table. I created a second table from the second struct while trying to figure things out so I’ve included that as a “What the hell.” type of bonus.

Any help would be greatly appreciated! And thanks ahead of time to anyone who looks at this and takes a crack at it.

Does this mean
I’ll have to group a bunch of them
together or is there a method that
doesn’t suck to work with that I can
use to enter the data cleanly and have
it imported?

Depends on what you consider clean / sucky.

The Z column above is a material struct that is a part of another struct - that would be the equivalent of your Stats. I created an empty Data Table, added a single row and exported it as CSV - this shows me how the formatting should look like for a nested struct.

As you can see, it spits out quite a bit of gibberish. Luckily this can be cleaned up, I did it for the the Opacity, Colour and Glow. This has to be done only once and once you have a clean line with correct formatting, it can be duplicated freely, populated cleanly-ish with the desired data and reloaded back into the Data Table. It is still a clump but I found it quite manageable.


In case you want to store arrays of structs inside another struct, avoid CVS. Go for *.jsons - way more manageable.


Also, there are some changes heading Data Table ways, some really needed QoL improvements, like copy-pasting rows.

That’s pretty much what I thought I’d have to do. I really appreciate the confirmation man!

Also, with regard to the importing file type, what would be the benefit of going from a csv to a json?

I meant arrays specifically, there’s no clean-up needed and formatting is all neat and vertical. There used to be horrible mix ups with enumerators in csv, it may no longer be the case, though.

Array indexes in json:

279941-json.png

vs

Array indexes in csv:

Export your Data Table as json, open it and see if you like what you find and what will make it easier to work with.


The same nested material struct in json for comparison:

There’s more to it, of course - web requests, more info here:

Daaaaamn. I didn’t realize how much “cleaner” it is working with jsons. Huge thanks for the info and the resources!