#Getting the key of a table entry in Localization Package

1 messages ยท Page 1 of 1 (latest)

thorny warren
#

No matter how hard I try, I cannot access the key(string) of the entry i made.

still hatch
#

This feels like an XY-Problem. What do you need to know the key for?

thorny warren
still hatch
#

I did understand your question.
What I am wondering is why you need to obtain the key.

And also, with what information are you trying to get said key?
Do you need a list of all keys inside a given table?
Are you trying to make a sort of reverse lookup of table entries where you feed it a value and it gives a key?
Something else?

thorny warren
still hatch
#

Okay, that answers what you want to do with the key. But why do you want to check the key, specifically?

According to this forum post, you can obtain the key of a given LocalizedString using cs var tableEntry = LocalizationSettings.StringDatabase.GetTableEntry(dialogueLocalizedRef.TableReference, dialogueLocalizedRef.TableEntryReference); var key = tableEntry.Entry.SharedEntry.Key;
However, since your purpose is to evaluate the key, I strongly urge you to use metadata instead.
If you click the {๐Ÿ“} button above the value of your table entry, you can expand its metadata sidebar. There you can add metadata to both the individual entry, as well as the entire row (via the "Shared Entry" field).
You can either use one of the built-in metadata classes, or create your own one. and access it through ```cs
LocalizationSettings.StringDatabase.GetTableEntry(localizedString.TableReference, localizedString.TableEntryReference).Entry.GetMetadata<YourMetadataType>()

thorny warren
thorny warren
#

@still hatch
I found another way to obtain the key name as string. It's ResolveKeyName function. But it needs a parameter called "SharedTableData". And i cant find a way to reference my LocalizedString as a parameter to this function.

still hatch
#

If I'm reading the documentation correctly, you may be able to just pass null into ResolveKeyName.

But seriously, why are you so hell-bent on getting that key?
The purpose of the keys is to access their associated data. NOT the other way around. And it's very likely that getting the key will be a slower operation.

thorny warren