I would like to iterate the keys of an ESObject and then get each value based on the keys.
I would like to iterate the keys of an ESObject and then get each value based on the keys.
What I think might work is a foreach() on the EsObject, which I'm guessing returns an EsObjectDataHolder instance in the loop. Looks like I can get the Name (key) from that, then get the value, as well.
It would be nice to have even one sentence in the API docs about what/where/why for EsObjectDataHolder. Total shot in the dark, here.
*fingers crossed*
I'll have to research this and get back to you. I know how to do it for Java; see the PluginIteratingOverEsObject code example's plugin.
Last edited by tcarr; 08-20-2012 at 01:33 PM.
Teresa Carrigan
Senior Engineer
Electrotank, Inc.
The full source code for EsObjectDataHolder is found in apis/client/c_sharp/unity/src/api (or similar path for Generic C#).
This should work for you. Look at the source code for EsObject for more specific examples, such as toString and deepClone.
C# Code:foreach( EsObjectDataHolder holder in esob) { // name of the variable is holder.Name // datatype of the variable is holder.getDataType() which is an enum. // use the datatype to use the correct getter for the value }
Teresa Carrigan
Senior Engineer
Electrotank, Inc.
Thanks for the pointer!
Actually, what I proposed in my previous post worked.Doing a foreach( EsObjectDataHolder entry in myContainer ) {} gave me each entry, where I could use entry.Name to get the "key" and entry.GetIntegerValue() or whatever for the value.
Cheers!