playMaker

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

westingtyler

  • Full Member
  • ***
  • Posts: 210
    • View Profile
    • My Oculus Rift + Touch VR Game Using Playmaker
Hasht Table Get By Index (Not Key)
« 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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13638
  • Official Playmaker Support
    • View Profile
Re: Hasht Table Get By Index (Not Key)
« Reply #1 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

westingtyler

  • Full Member
  • ***
  • Posts: 210
    • View Profile
    • My Oculus Rift + Touch VR Game Using Playmaker
Re: Hasht Table Get By Index (Not Key)
« Reply #2 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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13638
  • Official Playmaker Support
    • View Profile
Re: Hasht Table Get By Index (Not Key)
« Reply #3 on: November 22, 2018, 10:57:39 PM »
Hi,

 yep :)

Bye,

 Jean

westingtyler

  • Full Member
  • ***
  • Posts: 210
    • View Profile
    • My Oculus Rift + Touch VR Game Using Playmaker
Re: Hasht Table Get By Index (Not Key)
« Reply #4 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?
« Last Edit: November 29, 2018, 12:59:18 AM by westingtyler »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13638
  • Official Playmaker Support
    • View Profile
Re: Hasht Table Get By Index (Not Key)
« Reply #5 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