So I have an data structure I am trying to convert to gdscript, its searchable by key:String, but can be ordered by a int and a float value.
This is whay I got so far :
var arrayValues = [] # [floatvalue, intvalue, stringname]
var dictData = {} # { key:String , arrayValuesIdx:int , datastructure }
To get all the data :
var x = dictData["string"]
var floatvalue = arrayValues[x.arrayValuesIdx].floatvalue
var intvalue = arrayValues[x.arrayValuesIdx].intvalue
The value of the float and intvalue will change in update cycle, but I also need to show in screen the values ordered by intvalue,floatvalue :
arrayValues.sort_custom(func(a, b): return (a[1]==b[1] and b[0]>=a[0]) or (a[1]>b[1]))
After sorting, how can I keep a relation with dictData and arrayValues ?
Is there another way to have a sorted data by numbers but still be able to find it by a string somehow ?
Obs: The number of itens is large so it needs to be fast search by key:string and fast sorting.