Code: Select all
tmap := map()
; ...add elements to tmap here
; get current element value
element := tmap[ "my_lookup_string" ]
; update the element value
if( element * element > 500 )
element := 500 / (element * element)
; update the element value in the map
tmap[ "my_lookup_string" ] := element
Related to something else, I timed the operations, and it appears that looking up elements from a large map of 250 elements is actually more efficient than constantly adding and removing from a small map of about 5 elements (it was close, but the large map was always faster). This means item lookup is actually faster than element addition/removal, which almost certainly means its using a hash map to find its elements. This is great/efficient, but is there any way for us to access the lookup data? Or any way for us to store a temporary node or reference to access the same element multiple times in a situation?
Thanks for any advice!
Edit: Sorry, didn't realize maps were new in V2. Thanks for moving, gregster.