Playmaker Forum

Playmaker Feedback => Action Requests => Topic started by: westingtyler on November 19, 2018, 05:19:42 PM

Title: Hasht Table Get By Index (Not Key)
Post by: westingtyler on November 19, 2018, 05:19:42 PM
Hash Table Get By Index (Not Key)

Has Table Get only allows by Key it seems, but I want to get them by a specific Int Index.
Title: Re: Hasht Table Get By Index (Not Key)
Post by: jeanfabre on November 19, 2018, 10:41:24 PM
Hi,

 hashtable doesn't work with indexes by design ( it doesn't maintain indexing at all), so for hashtable you must use key.

in your case, the key could be an string of an int, that's fine.


 Bye,

 Jean
Title: Re: Hasht Table Get By Index (Not Key)
Post by: westingtyler on November 22, 2018, 05:08:19 AM
is that why when I go into play mode, all the hashed things gets scrambled and is no longer alphabetized?
Title: Re: Hasht Table Get By Index (Not Key)
Post by: jeanfabre on November 22, 2018, 10:57:39 PM
Hi,

 yep :)

Bye,

 Jean
Title: Re: Hasht Table Get By Index (Not Key)
Post by: westingtyler on November 28, 2018, 09:46:56 PM
Is there an action to "Sort Hash Table alphabetically"? If not, I'd like to request that action. It would be very helpful for the Get Next in Hash action thing.

It would also be great to have an action to add all the keys of a hash table, to an fsm string array. would that be possible?

Also, an editor script, like under Tools, or something, that would sort the hash entries alphabetically would be super helpful in editor mode.

Also, how many keys can a Hash have before performance problems? is 500 keys too much?
Title: Re: Hasht Table Get By Index (Not Key)
Post by: jeanfabre on December 02, 2018, 10:54:05 PM
Hi,

The only way to sort hash is to extract the keys into an arraylist or FsmArray, then sort that array and iterate through that list instead of the hashtable, this way you can enforce order.

Edit mode hashtable sorting would be great yes, I agree.

you can go crazy with volume, I ran tests with hundreds or thousands entries and it's fine, both for arraylist and hashtable, of course it depends what you do with it, it you plan on iterate through each, then that's a no go... or you have to make it asynchronous with a progress bar, etc etc, which is possible.

Bye,

 Jean