playMaker

Author Topic: ArrayMaker/HashTable - Wrong usage?  (Read 1618 times)

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
ArrayMaker/HashTable - Wrong usage?
« on: June 10, 2018, 05:49:49 PM »
Hey! I'm a big fan of ArrayMaker and use it a lot. But suddenly I have an issue...

I can put different variables types to one hash table: couple of strings, some bools, integers, e.t.c. And I can work perfectly with this hash table until I need to iterate through all the data pairs.  :-\
Hash Table Get Next action just stop if I don't declare Type and Result values. But I obviously have an error if I declare type (because I got different types inside)



Did I do something wrong? Am I not allowed to save different types to one table or get next action should work different?

PS. For now I save all the keys to a separate array (Hash Table Keys action) and iterate this array instead of working with HashTable directly. But I feel like I'm increasing the entropy and produce unhealthy, overcoded solution...
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker/HashTable - Wrong usage?
« Reply #1 on: June 11, 2018, 03:21:32 AM »
Hi,

 yes, you are hitting a limitation of custom actions as they are...

and you are right, the solution is to iterate the keys and get the value for a particular key manually, because indeed they differ in types.

 so all is well, you can use your key list to iterate with, it's perfectly valid, but more complex, I give you that.

 Bye,

 Jeab

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: ArrayMaker/HashTable - Wrong usage?
« Reply #2 on: June 11, 2018, 07:28:30 AM »
It'd likely be possible to mash Hash Table Get Next and Hash Table Get Type together, but since you need a variable to store the result and it could be any type, you'd end up having to set a variable for every type possible and that doesn't sound right... maybe picking a type and skipping the key if that doesn't match the type could work better.