Hey guys. I've just started using data tables, and was wondering about efficient use. Specifically I'm using them to have a unit remember its spawning building (using unit tags). There's the potential of lots of units being spawned and therefore lots of Data tables being generated. When a particular unit dies, and its information is passed on to a newly spawning unit should I get rid of the old data table (generated from the old units tag)? Will using "Remove Data Table Value" get rid of it (By which I mean will it still be taking up information space, such as when you have a blank global variable)?
First of, you are not creating new data tables, you are just adding key - value pairs to either the global or the local data table. In your case you are probably only using the global data table.
To answer your question: Data tables can hold a lot of values (Not sure how many exactly, but its alot), however, you should make sure to remove no longer needed values from the data table. The more key-value pairs are stored in the table, the slower it will become (this is, inserting new elements or getting a key value).
So for example if a unit dies or gets removed, you should make sure to remove all data table values linked to that unit from the datatable as well. I also recommend implementing some sort of datatable debugging mechanism, such as: print whole data table, get amount of data table values, etc
Hey guys. I've just started using data tables, and was wondering about efficient use. Specifically I'm using them to have a unit remember its spawning building (using unit tags). There's the potential of lots of units being spawned and therefore lots of Data tables being generated. When a particular unit dies, and its information is passed on to a newly spawning unit should I get rid of the old data table (generated from the old units tag)? Will using "Remove Data Table Value" get rid of it (By which I mean will it still be taking up information space, such as when you have a blank global variable)?
Thanks.
First of, you are not creating new data tables, you are just adding key - value pairs to either the global or the local data table. In your case you are probably only using the global data table.
To answer your question: Data tables can hold a lot of values (Not sure how many exactly, but its alot), however, you should make sure to remove no longer needed values from the data table. The more key-value pairs are stored in the table, the slower it will become (this is, inserting new elements or getting a key value).
So for example if a unit dies or gets removed, you should make sure to remove all data table values linked to that unit from the datatable as well. I also recommend implementing some sort of datatable debugging mechanism, such as: print whole data table, get amount of data table values, etc
Okay, thanks.