playMaker

Author Topic: Hash Table sorting order on play Question  (Read 2758 times)

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Hash Table sorting order on play Question
« on: December 23, 2015, 01:50:43 PM »
Why does the hashtable re-sorts itself on play? See attached picture.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Hash Table sorting order on play Question
« Reply #1 on: January 24, 2017, 03:06:01 AM »
Hi,

 Unfortunatly, because hashtable order doesn't matter and so internally it's not enforced and can change.

the only way to show an ordered list comign from a hashtable is to extract the keys, sort them, and then display each item of that hashtable following the order of the sorted key.

does that make sense?

Bye,

 Jean


Abelius

  • Junior Playmaker
  • **
  • Posts: 68
Re: Hash Table sorting order on play Question
« Reply #2 on: November 09, 2020, 06:07:13 PM »
I was looking for an answer to this, and I've found it in this thread.

However, I'm curious why the order changes in the first place. Surely there should be a reason Unity decides to gratuiously resort the records on the table?
Unity 2019.4.9f1
Playmaker 1.9.7f1

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Hash Table sorting order on play Question
« Reply #3 on: November 09, 2020, 06:49:43 PM »
Hi.
A hashtable is an inherently unordered data structure.

Which means C# is doing this list 'randomly'