Best way to implement a 'lookup/hash table' in unreal?

Hi all,

I was looking at making a ‘lookup table’ for my inventory system.
The plan was to have an ID stored in the inventory, and fetch the inventory Icon/actor when needed, rather than store the actor itself.

I’m not sure the best way to go about this, I found a post about data tables but that involves reading in a csv, so doesn’t sound efficient.

I then say tho TMap container and thought that might do, but I thought it couldn’t hurt to ask if there was a better way to start.

Any and all advice would be appreciated.

TMap is probably what you want. If your IDs are small enough and you don’t plan on having too many items, you could do a simple array or such (which would give you constant time insert,access,and removal) where the ID is the spot in the array reserved for that item, but TMap is the probably the most flexible and log(n) insert/delete/access times are pretty small anyway.

You’ve described with the array solution pretty much what I’m doing for the inventory itself.
But I plan to have many different Items that the player could pickup, and would prefer more flexible solution. I shall continue with the TMap plan and see where than gets me.