Code example:
Code: Select all
EnableExplicit
Define.s sCurrentID, sCurrentValue, sAnotherValue
NewMap Numbers.s()
Numbers("1") = "I am 1"
Numbers("2") = "I am 2"
Numbers("3") = "I am 3"
Numbers("4") = "I am 4"
Numbers("5") = "I am 5"
sCurrentID = "3"
If FindMapElement(Numbers(), sCurrentID)
sCurrentValue = Numbers()
Debug "Current value: " + sCurrentValue
PushMapPosition(Numbers())
FindMapElement(Numbers(), "5")
sAnotherValue = Numbers()
Debug "Another value: " + sAnotherValue
PopMapPosition(Numbers())
sCurrentValue = Numbers()
Debug "Back to current value: " + sCurrentValue
Debug "Should be 'I am 3', but is still 'I am 5'"
EndIf
Code: Select all
Current value: I am 3
Another value: I am 5
Back to current value: I am 5
Should be 'I am 3', but is still 'I am 5'
I thought until now that the value of the map pointer is simply pushed onto the stack and later taken down again to restore the current map pointer with it.
Markus