Hi there…
For an Editor Utility, I try to populate Variables with Stuff from StringTables (TMap Keys made by Words of StringTable values as Example…).
To achieve this, i need to
1st: get ALL String Tables of the project.
2nd: Check if the StringTable has any Value and the Asset name contains a prefix.
3rd: read all Keys of a Table into a TArray.
4th: When iterating the Array of Keys, getting the corresponding values to the Keys.
Now… i may figured out how to load StringTables:
TArray<UStringTable*> ULoH_TextCrypter::GatherCryptingTables()
{
TArray<UStringTable*> FoundTables;
const FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
FARFilter Filter;
Filter.ClassPaths.Add(UStringTable::StaticClass()->GetClassPathName());
Filter.bRecursivePaths = true;
TArray<FAssetData> AssetDataList;
AssetRegistryModule.Get().GetAssets(Filter, AssetDataList);
for (const FAssetData& AssetData : AssetDataList)
{
if (AssetData.AssetClassPath.ToString().Contains(UStringTable::StaticClass()->GetFName().ToString()))
{
if (UStringTable* StringTable = Cast<UStringTable>(AssetData.GetAsset()))
{
const FName TableID = StringTable->GetStringTableId();
if (TSharedPtr<const FStringTable> ConstTablePtr = FStringTableRegistry::Get().FindStringTable(TableID); ConstTablePtr.IsValid())
{
int32 KeyCount = ConstTablePtr->; //<<< How?
if (AssetData.AssetName.ToString().Contains(TEXT("_crypt_")) && KeyCount > 0)
{
FoundTables.Add(StringTable);
}
}
}
}
}
return FoundTables;
}
I’m having trouble finding a function to retrieve the keys and values, or even the key-value pairs, from a StringTable. Specifically, neither FStringTable nor UStringTable seems to provide such functionality directly.
Does one have an idea how to get that working?