Map problem (array index out of bounds)

StDoodle

Minion
I was under the impression that I could go back and add additional key/value pairs to a map pretty much whenever I wanted. For example, a map called "arglist," where currently arglist[0] = "Bob" could be appended simply with: arglist[1] = "Sam". But when I try to do that in my script, I'm getting an "array out of bounds" exception. Perhaps this is because the map was populated with split_string(), which according to the wiki creates a map, but maybe it now creates a simple array type, which cannot take on new parameters? I dunno... any advice would be appreciated.

For reference, the script is found here: http://www.kolmafia.us/showthread.php?t=3443

Without specifying enough text parameters (<2) to the script, I get "Array index out of bounds (customdaily.ash, line 854)"

Edit: I tested my theory by using an additional map, and renaming the original as a temporary one. Then I did a foreach on the temp & copied the values to the regular map, and viola! it works. Confusing, but works...
 
Last edited:

jasonharper

Developer
Yeah, lots of the functions declared to return a map with integer keys actually return an array instead, for efficiency. You won't be able to add keys in that case.
 
Top