playMaker

Author Topic: Hasht Table Get By Index (Not Key)  (Read 2482 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Hasht Table Get By Index (Not Key)
« on: November 19, 2018, 07: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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Hasht Table Get By Index (Not Key)
« Reply #1 on: November 20, 2018, 12:41:24 AM »
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

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: Hasht Table Get By Index (Not Key)
« Reply #2 on: November 22, 2018, 07:08:19 AM »
is that why when I go into play mode, all the hashed things gets scrambled and is no longer alphabetized?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Hasht Table Get By Index (Not Key)
« Reply #3 on: November 23, 2018, 12:57:39 AM »
Hi,

 yep :)

Bye,

 Jean

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: Hasht Table Get By Index (Not Key)
« Reply #4 on: November 28, 2018, 11: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?
« Last Edit: November 29, 2018, 02:59:18 AM by westingtyler »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Hasht Table Get By Index (Not Key)
« Reply #5 on: December 03, 2018, 12:54:05 AM »
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